Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/barcodeinformation/action/BarcodeInformationAction.java =================================================================== diff -u --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/barcodeinformation/action/BarcodeInformationAction.java (revision 0) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/barcodeinformation/action/BarcodeInformationAction.java (revision 14820) @@ -0,0 +1,140 @@ +package com.forgon.disinfectsystem.basedatamanager.barcodeinformation.action; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletResponse; + +import net.sf.json.JSONObject; +import net.sf.json.JsonConfig; +import net.sf.json.util.PropertyFilter; + +import org.apache.commons.lang.StringUtils; +import org.apache.struts2.convention.annotation.Action; +import org.apache.struts2.convention.annotation.Namespace; +import org.apache.struts2.convention.annotation.ParentPackage; + +import com.forgon.disinfectsystem.basedatamanager.barcodeinformation.service.BarcodeInformationManager; +import com.forgon.disinfectsystem.entity.basedatamanager.barcodeinformation.BarcodeInformation; +import com.forgon.tools.StrutsParamUtils; +import com.forgon.tools.StrutsResponseUtils; +import com.forgon.tools.json.JsonPropertyFilter; +import com.opensymphony.xwork2.ModelDriven; +import com.opensymphony.xwork2.Preparable; + + +/** + * @author jeffli 2016年9月6日 上午9:03:54 + * + */ +@ParentPackage(value = "default") +@Namespace(value = "/disinfectSystem/baseData") +@Action(value = "barcodeInformationAction") +public class BarcodeInformationAction implements ModelDriven, Preparable { + + private BarcodeInformation barcodeInformation; + private BarcodeInformationManager barcodeInformationManager; + + + public void setBarcodeInformationManager(BarcodeInformationManager barcodeInformationManager) { + this.barcodeInformationManager = barcodeInformationManager; + } + + /** + * 保存barcodeInformation + */ + public String saveBarcodeInformation() { + if (barcodeInformation != null) { + barcodeInformationManager.saveOrUpdate(barcodeInformation); + } + return null; + } + + public void deleteBarcodeInformation() { + String idStr = StrutsParamUtils.getPraramValue("ids", ""); + String message = ""; + int success = 0, failure = 0; + if (StringUtils.isNotBlank(idStr)) { + String[] str = idStr.split(";"); + for (String id : str) { + try { + barcodeInformationManager.deleteBarcodeInformationById(id); + success++; + } catch (Exception e) { + failure++; + e.printStackTrace(); + } + } + } + message = "{success:true,msg:'"+success+"条记录删除成功,"+failure+"条记录删除失败!'}"; + HttpServletResponse httpServletResponse = StrutsParamUtils + .getResponse(); + httpServletResponse.setCharacterEncoding("UTF-8"); + try { + httpServletResponse.getWriter().print(message); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + *添加修改 BarcodeInformation + */ + public void loadBarcodeInformation() { + JsonConfig config = new JsonConfig(); + PropertyFilter propertyFilter = new JsonPropertyFilter(new String[] {}); + config.setJsonPropertyFilter(propertyFilter); + + Map map = new HashMap(); + map.put("success", true); + map.put("data", barcodeInformation); + JSONObject jsonObject = JSONObject.fromObject(map, config); + + StrutsResponseUtils.output(jsonObject); + } + + + /** + * + * + * @return + * @throws Exception + */ + public String getBarcodeInformationData() { + String id = StrutsParamUtils.getPraramValue("id", ""); + //供应商类型 + BarcodeInformation barcodeInformation = barcodeInformationManager.getBarcodeInformationById(id); + + if(barcodeInformation != null){ + StrutsResponseUtils.output(barcodeInformation.getInformation()); + } + return null; + } + + public void iniInfo() { + + String id = StrutsParamUtils.getPraramValue("id", ""); + if (StringUtils.isNotBlank(id) && !id.equals("0")) { + barcodeInformation = barcodeInformationManager.getBarcodeInformationById(id); + } else { + barcodeInformation = new BarcodeInformation(); + } + } + + public BarcodeInformation getBarcodeInformation() { + return barcodeInformation; + } + + public void setBarcodeInformation(BarcodeInformation barcodeInformation) { + this.barcodeInformation = barcodeInformation; + } + + public BarcodeInformation getModel() { + return barcodeInformation; + } + + public void prepare() throws Exception { + iniInfo(); + } +} Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/barcodeInformation/barcodeInformation.jsp =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/basedatamanager/barcodeInformation/barcodeInformation.jsp (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/basedatamanager/barcodeInformation/barcodeInformation.jsp (revision 14820) @@ -0,0 +1,61 @@ +<%@page import="com.forgon.disinfectsystem.entity.basedatamanager.supplier.Supplier "%> +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ include file="/common/taglibs.jsp"%> + + + +条码信息 + + +<%@ include file="/common/includeExtJsAndCss.jsp"%> + + + + + + + + + + + + + + + +
+
+
+
+ +
+ + \ No newline at end of file Index: ssts-web/src/main/webapp/WEB-INF/dwr.xml =================================================================== diff -u -r14631 -r14820 --- ssts-web/src/main/webapp/WEB-INF/dwr.xml (.../dwr.xml) (revision 14631) +++ ssts-web/src/main/webapp/WEB-INF/dwr.xml (.../dwr.xml) (revision 14820) @@ -43,6 +43,10 @@ + + + + Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/barcodeInformation/barcodeInformation.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/basedatamanager/barcodeInformation/barcodeInformation.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/basedatamanager/barcodeInformation/barcodeInformation.js (revision 14820) @@ -0,0 +1,168 @@ +var entityName = "条码信息管理"; +var grid; +var barcodeInformationWin; +var barcodeInformationJsonObj = {}; + +// 删除 +function deleteBarcodeInformation(grid) { + + var records = grid.getSelectionModel().getSelections(); + + if (records.length == 0) { + showResult("请选择要删除的条码信息!"); + return false; + } + var ids = null; + for ( var i = 0, len = records.length; i < len; i++) { + if (ids == null) { + ids = records[i].data['id']; + } else { + ids = ids + ';' + records[i].data['id']; + } + } + top.Ext.MessageBox + .confirm("请确认", + "是否确定要删除选中的条码信息?", + function(button, text) { + if ("yes" == button){ + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/baseData/barcodeInformationAction!deleteBarcodeInformation.do', + params : { + ids : ids + },success : function(response, options) { + var result = Ext.decode(response.responseText); + var success = result.success; + showResult(result.msg); + if (true != success) { + return; + } else { + grid.dwrReload(); + } + }, + failure : function(response, options) { + var result = Ext.decode(response.responseText); + showResult(result.cause); + } + });} + }); + +} + +var loadFormData = function(grid) { + var records = grid.getSelectionModel().getSelections(); + if (records.length == 0) { + showResult("请选择要修改的条码!"); + return false; + } + if (records.length > 1) { + showResult("一次只能修改一个条码!"); + return false; + } + id = records[0].data['id']; + var informationType = records[0].data['informationType']; + switch(informationType){ + case '一次性物品入库': + addAndEditDisposablegoodsGodownentry(id); + break; + } +}; + +/** + * 修改记录 + * modifyRecord函数 触发modify函数调用,并传入当前列的值以及record.data对象 + * 页面中需要定义 modify(v,data) 函数 + */ +function modify(v,data){ + loadFormData(grid); +} + +Ext.onReady(function() { + Ext.QuickTips.init(); + var columns = [ { + id : 'barcode', + header : "条码", + width : 100, + dataIndex : 'barcode', + renderer : modifyRecord + }, { + id : 'informationType', + header : "类型", + width : 500, + dataIndex : 'informationType' + }]; + + var filters = new Ext.grid.GridFilters({ + filters : [ + {type:'string',dataIndex:'barcode'}, + {type:'string',dataIndex:'informationType'} + ] + }); + + var readerDetail = [ { + name : 'id' + }, { + name : 'barcode' + }, { + name : 'informationType' + }]; + + var sign = true; + var tbar = [{ + text : '添加一次性物品入库', +// hidden : SSTS_BarcodeInformation_Create, + iconCls : 'btn_ext_application_add', + handler : function() { + addAndEditDisposablegoodsGodownentry(0); + } + }, '-', { + text : '修改', +// hidden : SSTS_BarcodeInformation_Update, + iconCls : 'btn_ext_application_edit', + id : 'editTbar', + handler : function() { + loadFormData(grid); + } + }, '-', { + text : '删除', +// hidden : SSTS_BarcodeInformation_Delete, + iconCls : 'btn_ext_application_del', + handler : function() { + deleteBarcodeInformation(grid); + } + } ]; + var dwrCallParams = null; + + Ext.ux.ForgonPageGrid.prototype.getGridParameterMap = function() { + + }; + + grid = new Ext.ux.ForgonPageGrid( { + tbar : tbar, + pageSize : 20, + defaultSortField : 'id', + title : '条码信息列表', + defaultSortDirection : 'ASC', + isCheckboxSelectionModel : true, + rememberSelected : false, + isShowSearchField : true, + columns : columns, + plugins : filters, + autoExpandColumn : 'informationType', + renderTo : 'gridDiv', + frame : false + }, readerDetail, + BarcodeInformationTableManager.findBarcodeInformationTableList, + dwrCallParams + ); + + var viewport = new Ext.Viewport( { + layout : 'border', + items : [{ + region : 'center', + margins : '0 0 0 0', + layout : 'fit', + items : grid + } ] + }); + + }); \ No newline at end of file Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/barcodeInformation/godownEntryForm.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/basedatamanager/barcodeInformation/godownEntryForm.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/basedatamanager/barcodeInformation/godownEntryForm.js (revision 14820) @@ -0,0 +1,243 @@ +var id; +var formObj; + +function addAndEditDisposablegoodsGodownentry(id) { + this.id = id; + barcodeInformationJsonObj = {}; + + // 全部一次性物品 + var allDiposableGoodsStore = new Ext.data.Store({ + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/diposableGoodsAction!getDiposableGoodsData.do?allItems=yes', + method : 'POST' + }), + reader : new Ext.data.JsonReader({ + totalProperty : 'totalCount', + root : 'data' + }, [ + {name : 'id',mapping : 'id'}, + {name : 'spelling',mapping : 'spelling'}, + {name : 'name',mapping : 'name'}, + {name : 'displayName',mapping : 'displayName'}, + {name : 'referencePrice',mapping : 'referencePrice'} + ]) + }); + + var supplierStore = new Ext.data.Store({ + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/baseData/supplierAction!getSupplierData.do?supplierType='+encodeURI(SUPPLIER_TYPE_SUPPLIER), + method : 'POST' + }), + reader : new Ext.data.JsonReader({ + totalProperty : 'totalCount', + root : 'data' + }, [ + {name : 'id',mapping : 'id'}, + {name : 'name',mapping : 'name'} + ]) + }); + + formObj = new top.Ext.FormPanel( { + id : 'barcodeInformationForm', + frame : true, + layout : 'form', + labelAlign:'right', + labelSeparator : ':', + bodyStyle : 'padding:5px 5px 0px 5px', + labelWidth : 100, + autoHeight : true, + autoScroll : true, + items : [ { + xtype : 'hidden', + name : 'id', + id : 'id' + },{ + xtype : 'hidden', + name : 'informationType', + id : 'informationType' + }, { + xtype : 'hidden', + name : 'information', + id : 'information' + }, { + xtype : 'combo', + fieldLabel : "物品名称", + id : 'disposableGoodsName', + name : 'disposableGoodsName', + queryParam : 'spell', + minChars : 0, + valueField : 'id', + displayField : 'name', + store : allDiposableGoodsStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + allowBlank : true, + width : 300, + tabIndex : 1, + selectOnFocus : true, + listeners : { + select : function(combo, record, index) { + barcodeInformationJsonObj.disposableGoodsName = record.data.name; + barcodeInformationJsonObj.disposableGoodsId = record.data.id; + }, + specialkey : function(field, ee) { + if (ee.getKey() == Ext.EventObject.ENTER) { +// top.Ext.getCmp('amount1').focus(); +// top.Ext.getCmp('amount1').selectText(); + } + } + } + },{ + xtype : 'textfield', + fieldLabel : "价格", + maxLength : '16', + id : 'price', + name : 'price', + width : 100, + tabIndex : 7, + regex: /^(([1-9]+[0-9]*.{1}[0-9]+)|([0].{1}[1-9]+[0-9]*)|([1-9][0-9]*)|([0][.][0-9]+[1-9]*))$/, + regexText:'只能输入正数', + allowBlank:true, + listeners : { + specialkey : function(field, e) { + if (e.getKey() == Ext.EventObject.ENTER) { + } + } + } + },{ + xtype : 'combo', + fieldLabel : "供应商", + id : 'supplierName', + name : 'supplierName', + queryParam : 'supplierName', + minChars : 0, + valueField : 'name', + displayField : 'name', + store : supplierStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + selectOnFocus :true, + allowBlank : true, + width : 300, + tabIndex : 8, + listeners : { + select : function(field, r) { + barcodeInformationJsonObj.supplierName = r.data.name; + }, + specialKey:function(f,e){ + if (e.getKey() == Ext.EventObject.ENTER) { + } + } + } + },{ + xtype : 'textfield', + fieldLabel : "注册证号", + id : 'certification', + name : 'certification', + width : 300, + tabIndex : 12, + allowBlank:true, + listeners : { + specialkey : function(field, e) { + var key = e.getKey(); + if (key == Ext.EventObject.ENTER) { +// top.Ext.getCmp('name1').focus(); +// top.Ext.getCmp('name1').selectText(); + } + } + } + }], + buttons : [ { + id : 'saveBtn', + text : '保存', + handler : saveBarcodeInformation + }, { + text : '取消', + id : 'cancelBtn', + handler : cancel + } ] + }); + + barcodeInformationWin = new top.Ext.Window( { + id : 'barcodeInformationWin', + layout : 'fit', + title : '供应商信息', + width : 600, + border : false, + modal : true, + autoHeight : true, + plain : true, + items : [ formObj ] + }); + barcodeInformationWin.show(); + + if(id != 0){ + formObj.form.load( { + url : WWWROOT + '/disinfectSystem/baseData/barcodeInformationAction!loadBarcodeInformation.do', + method : 'GET', + waitMsg : '正在加载数据,请稍候', + success : function(form, action) { + setInformationOnload(); + }, + failure : function(form, action) { + }, + params : { + id : id + } + }); + } + +} + +function buildInformationForSave(){ + top.Ext.getCmp('informationType').setValue('一次性物品入库'); + barcodeInformationJsonObj.price = top.Ext.getCmp('price').getValue(); + barcodeInformationJsonObj.certification = top.Ext.getCmp('certification').getValue(); + var barcodeInformationJsonStr = JSON.stringify(barcodeInformationJsonObj); + top.Ext.getCmp('information').setValue(barcodeInformationJsonStr); +} +function setInformationOnload(){ + var informationStr = top.Ext.getCmp('information').getValue(); + barcodeInformationJsonObj = JSON.parse(informationStr); + top.Ext.getCmp('disposableGoodsName').setValue(barcodeInformationJsonObj.disposableGoodsName); + top.Ext.getCmp('price').setValue(barcodeInformationJsonObj.price); + top.Ext.getCmp('supplierName').setValue(barcodeInformationJsonObj.supplierName); + top.Ext.getCmp('certification').setValue(barcodeInformationJsonObj.certification); +} +function validateAndSubmit(){ + buildInformationForSave(); + formObj.form.submit( { + url : WWWROOT + '/disinfectSystem/baseData/barcodeInformationAction!saveBarcodeInformation.do', + method : 'POST', + waitMsg : '正在保存数据,请稍候', + waitTitle : '提交表单', + success : function(form, action) { + barcodeInformationWin.close(); + showResult('保存成功'); + grid.dwrReload(); + }, + failure : function(form, action) { + showResult(action.result.message); + top.Ext.getCmp('saveBtn').enable(); + } + }); +} + +function saveBarcodeInformation() { + this.disable(); + if (!formObj.form.isValid()) { + showResult("请正确填写表单各值"); + this.enable(); + return false; + } + validateAndSubmit(); +} +function cancel() { + barcodeInformationWin.close(); +} Index: ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/action/GodownEntryAction.java =================================================================== diff -u -r14638 -r14820 --- ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/action/GodownEntryAction.java (.../GodownEntryAction.java) (revision 14638) +++ ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/action/GodownEntryAction.java (.../GodownEntryAction.java) (revision 14820) @@ -39,6 +39,7 @@ import com.forgon.disinfectsystem.entity.assestmanagement.ExpensiveDisposablegoods; import com.forgon.disinfectsystem.entity.assestmanagement.GodownEntry; import com.forgon.disinfectsystem.entity.assestmanagement.GodownEntryItem; +import com.forgon.disinfectsystem.entity.basedatamanager.barcodeinformation.BarcodeInformation; import com.forgon.disinfectsystem.entity.basedatamanager.toussedefinition.TousseDefinition; import com.forgon.disinfectsystem.entity.basedatamanager.toussedefinition.TousseInstance; import com.forgon.disinfectsystem.entity.tousseitem.TousseItem; @@ -805,6 +806,42 @@ e.printStackTrace(); } } + public String loadBarcodeDeviceInfo() { + String barcode = StrutsParamUtils.getPraramValue("barcode", ""); + Map returnMsg = new HashMap(); + returnMsg.put("success", false); + returnMsg.put("errMsg", "加载失败"); + + try { + if (StringUtils.isBlank(barcode)) { + throw new RuntimeException("条码不能为空!"); + } + BarcodeDevice barcodeDevice = barcodeManager + .getBarcodeByBarcode(barcode); + if (barcodeDevice == null){ + throw new RuntimeException("查无此物品"); + } + if(barcodeDevice instanceof BarcodeInformation){// 高值耗材处理 + returnMsg.put("barcodeType", BarcodeDevice.BARCODE_TYPE_BARCODEINFORMATION); + returnMsg.put("barcodeInformation", barcodeDevice); + }else{ + throw new RuntimeException("不支持的条码类型!"); + } + + returnMsg.put("success", true); + } catch (Exception e) { + e.printStackTrace(); + returnMsg.put("errMsg", e.getMessage()); + } + try { + StrutsParamUtils.getResponse().setCharacterEncoding("UTF-8"); + String jsonStr = JSONUtil.toJSONString(returnMsg,true); + StrutsParamUtils.getResponse().getWriter().print(jsonStr); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } @Override public GodownEntry getModel() { return godownEntry; Index: forgon-core/src/main/java/com/forgon/directory/model/BarcodeDevice.java =================================================================== diff -u -r13519 -r14820 --- forgon-core/src/main/java/com/forgon/directory/model/BarcodeDevice.java (.../BarcodeDevice.java) (revision 13519) +++ forgon-core/src/main/java/com/forgon/directory/model/BarcodeDevice.java (.../BarcodeDevice.java) (revision 14820) @@ -40,6 +40,7 @@ public static final String BARCODE_TYPE_SIGNBOARD = "标识牌"; public static final String BARCODE_TYPE_WAREHOUSE = "仓库"; public static final String BARCODE_TYPE_EXPENSIVEDIPOSABLEGOODS = "高值耗材"; + public static final String BARCODE_TYPE_BARCODEINFORMATION = "条码信息"; @Id @GeneratedValue(strategy = GenerationType.AUTO) Index: forgon-tools/src/main/java/com/forgon/tools/StrutsResponseUtils.java =================================================================== diff -u -r14656 -r14820 --- forgon-tools/src/main/java/com/forgon/tools/StrutsResponseUtils.java (.../StrutsResponseUtils.java) (revision 14656) +++ forgon-tools/src/main/java/com/forgon/tools/StrutsResponseUtils.java (.../StrutsResponseUtils.java) (revision 14820) @@ -71,6 +71,13 @@ doOutput(array,response); } /** + * 向页面输出obj + * @param obj + */ + public static void output(Object obj){ + doOutput(obj,StrutsParamUtils.getResponse()); + } + /** * 内部实现函数,实现输出功能 * @param obj * @param response Index: ssts-web/src/main/webapp/homepage/menuconfigure.js =================================================================== diff -u -r14770 -r14820 --- ssts-web/src/main/webapp/homepage/menuconfigure.js (.../menuconfigure.js) (revision 14770) +++ ssts-web/src/main/webapp/homepage/menuconfigure.js (.../menuconfigure.js) (revision 14820) @@ -516,6 +516,7 @@ {hidden :SSTS_DiposableGoodsType,text:"一次性物品类型设置",href:WWWROOT+'/systemmanage/httpOption.mhtml?listId=diposableGoodsType',hrefTarget:linkTarget,leaf:true}, {hidden :SSTS_Container,text:"容器管理",href:WWWROOT+'/disinfectsystem/basedatamanager/container/containerView.jsp?editMode=true',hrefTarget:linkTarget,leaf:true}, {hidden :SSTS_Supplier,text:"供应商管理",href:WWWROOT+'/disinfectsystem/basedatamanager/supplier/supplierView.jsp?editMode=true',hrefTarget:linkTarget,leaf:true}, + {hidden :SSTS_SupplyRoomType,text:"条码信息",href:WWWROOT+'/disinfectsystem/basedatamanager/barcodeInformation/barcodeInformation.jsp?editMode=true',hrefTarget:linkTarget,leaf:true}, {hidden :SSTS_CleanMethod,text:"清洗程序管理",href:WWWROOT+'/disinfectsystem/basedatamanager/cleanmethod/cleanMethodView.jsp?editMode=true',hrefTarget:linkTarget,leaf:true}, {hidden :SSTS_Rinser,text:"清洗机管理",href:WWWROOT+'/disinfectsystem/basedatamanager/rinser/rinserView.jsp?editMode=true',hrefTarget:linkTarget,leaf:true}, {hidden :SSTS_Sterilisation,text:"灭菌程序管理",href:WWWROOT+'/disinfectsystem/basedatamanager/sterilisation/sterilisationView.jsp?editMode=true',hrefTarget:linkTarget,leaf:true}, Index: ssts-web/src/main/resources/spring/applicationContext-disinfectsystem-service.xml =================================================================== diff -u -r14631 -r14820 --- ssts-web/src/main/resources/spring/applicationContext-disinfectsystem-service.xml (.../applicationContext-disinfectsystem-service.xml) (revision 14631) +++ ssts-web/src/main/resources/spring/applicationContext-disinfectsystem-service.xml (.../applicationContext-disinfectsystem-service.xml) (revision 14820) @@ -212,14 +212,26 @@ - + + + + + + + + + + + Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/barcodeinformation/dwr/table/BarcodeInformationTableManager.java =================================================================== diff -u --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/barcodeinformation/dwr/table/BarcodeInformationTableManager.java (revision 0) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/barcodeinformation/dwr/table/BarcodeInformationTableManager.java (revision 14820) @@ -0,0 +1,32 @@ +package com.forgon.disinfectsystem.basedatamanager.barcodeinformation.dwr.table; + +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.StringUtils; + +import com.forgon.component.grid.GridManager; +import com.forgon.disinfectsystem.entity.basedatamanager.barcodeinformation.BarcodeInformation; + + +/** + * @author jeffli 2016年9月6日 上午9:03:54 + * + */ + +public class BarcodeInformationTableManager { + + private GridManager gridManager; + + public void setGridManager(GridManager gridManager) { + this.gridManager = gridManager; + } + + public String findBarcodeInformationTableList(Map> parameterMap) { + + String sql = "where 1=1 "; + return gridManager.renderGrid(parameterMap, BarcodeInformation.class + .getSimpleName(), sql, new String[] {}); + } + +} Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/barcodeinformation/service/BarcodeInformationManager.java =================================================================== diff -u --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/barcodeinformation/service/BarcodeInformationManager.java (revision 0) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/barcodeinformation/service/BarcodeInformationManager.java (revision 14820) @@ -0,0 +1,24 @@ +package com.forgon.disinfectsystem.basedatamanager.barcodeinformation.service; + +import java.util.List; + +import net.sf.json.JSONObject; + +import com.forgon.disinfectsystem.entity.basedatamanager.barcodeinformation.BarcodeInformation; + + + +/** + * @author jeffli 2016年9月6日 上午9:03:54 + * + */ +public interface BarcodeInformationManager { + + public void saveOrUpdate(BarcodeInformation barcodeInformation); + + public BarcodeInformation getBarcodeInformationById(String id); + + public void deleteBarcodeInformationById(String id); + + public List getAllBarcodeInformation(); +} Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/barcodeinformation/BarcodeInformation.java =================================================================== diff -u --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/barcodeinformation/BarcodeInformation.java (revision 0) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/barcodeinformation/BarcodeInformation.java (revision 14820) @@ -0,0 +1,51 @@ +/** + * + */ +package com.forgon.disinfectsystem.entity.basedatamanager.barcodeinformation; + +import javax.persistence.Entity; + +import org.apache.commons.lang3.StringUtils; +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; + +import com.forgon.directory.model.BarcodeDevice; + +/** + * @author jeffli + * + */ +@Entity +@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) +public class BarcodeInformation extends BarcodeDevice { + + public static String TYPE_DISPOSABLEGOODS_GODOWNENTRY = "一次性物品入库"; + + private String informationType; + private String information; // json 字符串 + + public String getInformationType() { + return informationType; + } + + public void setInformationType(String informationType) { + this.informationType = informationType; + } + + public String getInformation() { + return information; + } + + public void setInformation(String information) { + this.information = information; + } + + public void validateForSave() { + if (StringUtils.isBlank(informationType)) { + throw new RuntimeException("类型不能为空 !"); + } + if (StringUtils.isBlank(information)) { + throw new RuntimeException("信息不能为空!"); + } + } +} Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/barcodeinformation/service/BarcodeInformationManagerImpl.java =================================================================== diff -u --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/barcodeinformation/service/BarcodeInformationManagerImpl.java (revision 0) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/barcodeinformation/service/BarcodeInformationManagerImpl.java (revision 14820) @@ -0,0 +1,57 @@ +package com.forgon.disinfectsystem.basedatamanager.barcodeinformation.service; + +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.forgon.directory.model.BarcodeDevice; +import com.forgon.disinfectsystem.entity.basedatamanager.barcodeinformation.BarcodeInformation; +import com.forgon.serialnumber.model.SerialNum; +import com.forgon.serialnumber.service.SerialNumManager; +import com.forgon.tools.hibernate.ObjectDao; + +/** + * @author jeffli 2016年9月6日 上午9:03:54 + * + */ +public class BarcodeInformationManagerImpl implements BarcodeInformationManager { + + private ObjectDao objectDao; + private SerialNumManager serialNumManager; + + public void setObjectDao(ObjectDao objectDao) { + this.objectDao = objectDao; + } + + public void setSerialNumManager(SerialNumManager serialNumManager) { + this.serialNumManager = serialNumManager; + } + + public void saveOrUpdate(BarcodeInformation barcodeInformation) { + if (StringUtils.isBlank(barcodeInformation.getBarcode())) { + String barcode = serialNumManager + .getSerialNumberStr(SerialNum.TYPE_BARCODE); + barcodeInformation.setBarcode(barcode); + barcodeInformation + .setType(BarcodeDevice.BARCODE_TYPE_BARCODEINFORMATION); + } + objectDao.saveOrUpdate(barcodeInformation); + } + + public BarcodeInformation getBarcodeInformationById(String id) { + return (BarcodeInformation) objectDao.getByProperty( + BarcodeInformation.class.getSimpleName(), "id", + Long.valueOf(id)); + } + + public void deleteBarcodeInformationById(String id) { + objectDao.delete(getBarcodeInformationById(id)); + } + + @SuppressWarnings("unchecked") + public List getAllBarcodeInformation() { + return objectDao.findAllObjects(BarcodeInformation.class + .getSimpleName()); + } + +} Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownEntryView.js =================================================================== diff -u -r14550 -r14820 --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownEntryView.js (.../godownEntryView.js) (revision 14550) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownEntryView.js (.../godownEntryView.js) (revision 14820) @@ -117,7 +117,18 @@ {name : 'id'}, {name : 'batchNumber'} ] - }) + }), + listeners: { + beforeload: function(s,options){ +// var disposableGoodsID = top.Ext.getCmp('disposableGoodsID').getValue(); +// if(isUndefinedOrNullOrEmpty(disposableGoodsID)){ +// showResult('请先选择物品!'); +// return false; +// } +// s.baseParams.disposableGoodsID = disposableGoodsID; + return true; + } + } }); var hasTypeStore = new Ext.data.SimpleStore({ fields : ['hasType'], @@ -344,6 +355,56 @@ } setTotalMoney(top.Ext.getCmp('godownEntryItemGrid')); } + +function loadReturnDiposableGoodsItem() { + var barcode = top.Ext.getCmp('barcode').getValue(); + // 清除已加载的信息 + top.Ext.getCmp("barcode").setValue('');// 清除条码 + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/godownEntryAction!loadBarcodeDeviceInfo.do', + params : { + barcode : barcode + }, + success : function(response, options) { + var result = response.responseText; + if (result != null && result != "null") { + var resultObj = JSON.parse(result); + + if(!resultObj.success){ + showResult(resultObj.errMsg); + return; + } + if(resultObj.barcodeType == '条码信息'){ + var info = JSON.parse(resultObj.barcodeInformation.information); + if(!isUndefinedOrNullOrEmpty(info.disposableGoodsName)){ + top.Ext.getCmp('name1').setValue(info.disposableGoodsName); + top.Ext.getCmp('disposableGoodsID').setValue(info.disposableGoodsId); + batchNumStore.baseParams.disposableGoodsID = info.disposableGoodsId; + batchNumStore.load(); + } + if(!isUndefinedOrNullOrEmpty(info.price)){ + top.Ext.getCmp('cost1').setValue(info.price); + } + if(!isUndefinedOrNullOrEmpty(info.supplierName)){ + top.Ext.getCmp('supplier1').setValue(info.supplierName); + } + if(!isUndefinedOrNullOrEmpty(info.certification)){ + top.Ext.getCmp('certification').setValue(info.certification); + } + }else{ + + } + }else{ + showResult('输入的条码无效!'); + } + + }, + failure : function(response, options) { + var result = Ext.decode(response.responseText); + } + }); +} + var selectModel = new top.Ext.grid.CheckboxSelectionModel(); function addGodownEntry(type) { wareHouseStore.load(); @@ -706,6 +767,23 @@ name : 'barcode', id : 'barcode' },{ + text : '扫描条码 :' + },{ + xtype : 'textfield', + id : 'barcode', + name : 'barcode', + width :90, + enableKeyEvents : true, + listeners : { + render : function(c) { + c.getEl().on('keypress',function(e) { + if (e.getKey() == 13) {// 输入;号键,grid重新加载 + loadReturnDiposableGoodsItem(); + } + }); + } + } + },{ text : '物品名称:' },{ xtype : 'combo',