Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/warehouse/wareHouseView.js =================================================================== diff -u -r12741 -r12835 --- ssts-web/src/main/webapp/disinfectsystem/basedatamanager/warehouse/wareHouseView.js (.../wareHouseView.js) (revision 12741) +++ ssts-web/src/main/webapp/disinfectsystem/basedatamanager/warehouse/wareHouseView.js (.../wareHouseView.js) (revision 12835) @@ -27,7 +27,7 @@ var result = Ext.decode(response.responseText); var success = result.success; if (true != success) { - showResult(result.cause); + showResult(result.message); return; } else { showResult('删除成功'); @@ -36,7 +36,7 @@ }, failure : function(response, options) { var result = Ext.decode(response.responseText); - showResult(result.cause); + showResult(result.message); } }); }); Index: ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/action/TousseDefinitionAction.java =================================================================== diff -u -r12818 -r12835 --- ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/action/TousseDefinitionAction.java (.../TousseDefinitionAction.java) (revision 12818) +++ ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/action/TousseDefinitionAction.java (.../TousseDefinitionAction.java) (revision 12835) @@ -1338,6 +1338,13 @@ } if(map != null){ + map.put("isApplyEntireTousse", tousseDefinition.getIsApplyEntireTousse()); + String isDisableIDCard = tousseDefinition.getIsDisableIDCard(); + String isThereIdentificationCard = "否"; + if("否".equals(isDisableIDCard)){ + isThereIdentificationCard = "是"; + } + map.put("isThereIdentificationCard", isThereIdentificationCard); if(TousseDefinition.PACKAGE_TYPE_DISINFECTION.equals(tousseDefinition.getTousseType())){ map.put("materials", tousseDefinitionManager.getMaterialsOfDisinfectionGoods(tousseDefinition, true).toString()); } Index: ssts-web/src/main/webapp/disinfectsystem/borrow/borrowingTousseForm.js =================================================================== diff -u -r12532 -r12835 --- ssts-web/src/main/webapp/disinfectsystem/borrow/borrowingTousseForm.js (.../borrowingTousseForm.js) (revision 12532) +++ ssts-web/src/main/webapp/disinfectsystem/borrow/borrowingTousseForm.js (.../borrowingTousseForm.js) (revision 12835) @@ -627,7 +627,7 @@ grid.dwrReload(); }, failure : function(form, action) { - showResult(action.failureType); + showResult(action.result.message); } }); } Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/warehouse/action/WareHouseAction.java =================================================================== diff -u -r12749 -r12835 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/warehouse/action/WareHouseAction.java (.../WareHouseAction.java) (revision 12749) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/warehouse/action/WareHouseAction.java (.../WareHouseAction.java) (revision 12835) @@ -157,7 +157,7 @@ } } catch (Exception e) { jsonObject.put("success", false); - jsonObject.put("message", "删除失败"); + jsonObject.put("message", "删除失败"+e.getMessage()); logger.error("删除仓库写入响应消息至前端失败:" + e); } HttpServletResponse httpServletResponse = StrutsParamUtils Index: ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/action/RecyclingRecordAction.java =================================================================== diff -u -r12685 -r12835 --- ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/action/RecyclingRecordAction.java (.../RecyclingRecordAction.java) (revision 12685) +++ ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/action/RecyclingRecordAction.java (.../RecyclingRecordAction.java) (revision 12835) @@ -962,8 +962,11 @@ } List invoicePlans = new ArrayList(); + /*List tempInvoicePlans = invoicePlanManager + .getAwaitForRecyclingInvoicePlan(supplyRoomType,orgUnitCoding);*/ + List tempInvoicePlans = invoicePlanManager - .getAwaitForRecyclingInvoicePlan(supplyRoomType,orgUnitCoding); + .getAwaitForRecyclingInvoicePlan(supplyRoomType,loginUserDeptCoding); //消毒物品申请单排在最下边 List disinfectApp = new ArrayList(); Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java =================================================================== diff -u -r12672 -r12835 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java (.../InvoicePlanManagerImpl.java) (revision 12672) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java (.../InvoicePlanManagerImpl.java) (revision 12835) @@ -242,17 +242,17 @@ orgUnitCodings = "'" + orgUnitCodings + "'"; } - sql += " and po.departCoding in (" + orgUnitCodings + ")"; + sql += " and po.handleDepartCoding in (" + orgUnitCodings + ")"; } - if (supplyRoomType == 1) { + /*if (supplyRoomType == 1) { sql += " and po.type != '" + InvoicePlan.TYPE_SECOND_SUPPLY_ROOM + "'"; } else if (supplyRoomType == 2) { sql += " and po.type = '" + InvoicePlan.TYPE_SECOND_SUPPLY_ROOM + "'"; } else { sql = "where 1!=1"; - } + }*/ // 此处是触摸屏回收待回收列表调用,而触摸屏回收不处理外来器械包,所以要加上过滤 sql += " and po.type != '" + InvoicePlan.TYPE_FOREIGNTOUSSEAPPLIACTION + "'"; Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/warehouse/wareHouseForm.js =================================================================== diff -u -r12741 -r12835 --- ssts-web/src/main/webapp/disinfectsystem/basedatamanager/warehouse/wareHouseForm.js (.../wareHouseForm.js) (revision 12741) +++ ssts-web/src/main/webapp/disinfectsystem/basedatamanager/warehouse/wareHouseForm.js (.../wareHouseForm.js) (revision 12835) @@ -31,6 +31,10 @@ name : 'orgUnitCode', id : 'orgUnitCode' },{ + xtype : 'hidden', + name : 'originalName', + id : 'originalName' + },{ layout : 'column', labelWidth : 80, items : [{ @@ -160,6 +164,7 @@ waitMsg : '正在加载数据,请稍候', success : function(form, action) { var wareHouse = action.result.data; + top.Ext.getCmp("originalName").setValue(wareHouse.name); }, failure : function(form, action) {}, params : {id : id} Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/warehouse/WareHouse.java =================================================================== diff -u -r12729 -r12835 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/warehouse/WareHouse.java (.../WareHouse.java) (revision 12729) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/warehouse/WareHouse.java (.../WareHouse.java) (revision 12835) @@ -6,6 +6,7 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; +import javax.persistence.Transient; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; @@ -68,6 +69,11 @@ */ private Date createTime; + /** + * 修改之前的名字(不做映射) + */ + private String originalName; + public String getName() { return name; } @@ -124,5 +130,13 @@ this.createTime = createTime; } + @Transient + public String getOriginalName() { + return originalName; + } + public void setOriginalName(String originalName) { + this.originalName = originalName; + } + } Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/warehouse/service/WareHouseManagerImpl.java =================================================================== diff -u -r12804 -r12835 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/warehouse/service/WareHouseManagerImpl.java (.../WareHouseManagerImpl.java) (revision 12804) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/warehouse/service/WareHouseManagerImpl.java (.../WareHouseManagerImpl.java) (revision 12835) @@ -15,7 +15,22 @@ import com.forgon.directory.model.OrgUnit; import com.forgon.directory.service.OrgUnitManager; import com.forgon.directory.vo.LoginUserData; +import com.forgon.disinfectsystem.entity.assestmanagement.DisposableGoodsBatchStock; +import com.forgon.disinfectsystem.entity.assestmanagement.DisposableGoodsStock; +import com.forgon.disinfectsystem.entity.assestmanagement.GodownEntry; +import com.forgon.disinfectsystem.entity.assestmanagement.GodownEntryItem; +import com.forgon.disinfectsystem.entity.assestmanagement.IdentificationOfDisposableGoods; +import com.forgon.disinfectsystem.entity.basedatamanager.toussedefinition.TousseInstance; import com.forgon.disinfectsystem.entity.basedatamanager.warehouse.WareHouse; +import com.forgon.disinfectsystem.entity.goodsstock.GoodsStock; +import com.forgon.disinfectsystem.entity.invoicemanager.Invoice; +import com.forgon.disinfectsystem.entity.invoicemanager.InvoiceItem; +import com.forgon.disinfectsystem.entity.materialmanager.MaterialEntry; +import com.forgon.disinfectsystem.entity.materialmanager.MaterialEntryItem; +import com.forgon.disinfectsystem.entity.returngoodsrecord.ReturnGoodsItem; +import com.forgon.disinfectsystem.entity.returngoodsrecord.ReturnGoodsRecord; +import com.forgon.disinfectsystem.entity.stocktakemanager.StockTakeInfo; +import com.forgon.disinfectsystem.entity.stocktakemanager.StockTakeItem; import com.forgon.serialnumber.model.SerialNum; import com.forgon.serialnumber.service.SerialNumManager; import com.forgon.tools.hibernate.ObjectDao; @@ -122,11 +137,104 @@ barcode = serialNumManager.getSerialNumberStr(SerialNum.TYPE_BARCODE); wareHouse.setBarcode(barcode); } + + //是否需要更新其它实体表的仓库名称 + boolean needUpdateOtherEntityWareHouseName = false; + if(wareHouse.getId() != null && wareHouse.getId() != 0 && StringUtils.isNotBlank(wareHouse.getName()) + && StringUtils.isNotBlank(wareHouse.getOriginalName()) && !wareHouse.getName().equals(wareHouse.getOriginalName())){ + needUpdateOtherEntityWareHouseName = true; + } objectDao.saveOrUpdate(wareHouse); + + if(needUpdateOtherEntityWareHouseName){ + updateOtherEntityWareHouseName(wareHouse); + } return wareHouse; } /** + * 修改其它实体类的仓库名字 + * @param wareHouse + */ + public void updateOtherEntityWareHouseName(WareHouse wareHouse){ + try{ + objectDao.executeUpdate("update GoodsStock set wareHouseName='" + wareHouse.getName() + "' where wareHouseId=" + wareHouse.getId()); + objectDao.executeUpdate("update MaterialEntry set wareHouseName='" + wareHouse.getName() + "' where wareHouseId=" + wareHouse.getId()); + objectDao.executeUpdate("update MaterialEntryItem set wareHouseName='" + wareHouse.getName() + "' where wareHouseId=" + wareHouse.getId()); + objectDao.executeUpdate("update GodownEntry set warehouseName='" + wareHouse.getName() + "' where warehouseID=" + wareHouse.getId()); + objectDao.executeUpdate("update GodownEntry set targetWareHouseName='" + wareHouse.getName() + "' where targetWareHouseId=" + wareHouse.getId()); + objectDao.executeUpdate("update GodownEntryItem set warehouseName='" + wareHouse.getName() + "' where warehouseID=" + wareHouse.getId()); + objectDao.executeUpdate("update Invoice set warehouseName='" + wareHouse.getName() + "' where warehouseID=" + wareHouse.getId()); + objectDao.executeUpdate("update InvoiceItem set wareHouseName='" + wareHouse.getName() + "' where wareHouseId=" + wareHouse.getId()); + objectDao.executeUpdate("update StockTakeInfo set wareHouseName='" + wareHouse.getName() + "' where wareHouseId=" + wareHouse.getId()); + objectDao.executeUpdate("update StockTakeItem set wareHouseName='" + wareHouse.getName() + "' where wareHouseId=" + wareHouse.getId()); + objectDao.executeUpdate("update ReturnGoodsRecord set warehouseName='" + wareHouse.getName() + "' where warehouseID=" + wareHouse.getId()); + objectDao.executeUpdate("update ReturnGoodsItem set warehouseName='" + wareHouse.getName() + "' where warehouseID=" + wareHouse.getId()); + objectDao.executeUpdate("update TousseInstance set wareHouseName='" + wareHouse.getName() + "' where wareHouseId=" + wareHouse.getId()); + objectDao.executeUpdate("update DisposableGoodsStock set warehouseName='" + wareHouse.getName() + "' where warehouseID=" + wareHouse.getId()); + objectDao.executeUpdate("update DisposableGoodsBatchStock set warehouseName='" + wareHouse.getName() + "' where warehouseID=" + wareHouse.getId()); + objectDao.executeUpdate("update IdentificationOfDisposableGoods set warehouseName='" + wareHouse.getName() + "' where warehouseID=" + wareHouse.getId()); + }catch(Exception e){ + e.printStackTrace(); + } + } + + /** + * 查询其它实体表是否还有该仓库的关联数据 + * @param wareHouseId + * @return + */ + public Object getWareHouseFromOtherEntityById(Long wareHouseId){ + Object object = objectDao.getByProperty(GoodsStock.class.getSimpleName() , "wareHouseId" , wareHouseId); + if(object == null){ + object = objectDao.getByProperty(MaterialEntry.class.getSimpleName() , "wareHouseId" , wareHouseId); + } + if(object == null){ + object = objectDao.getByProperty(MaterialEntryItem.class.getSimpleName() , "wareHouseId" , wareHouseId); + } + if(object == null){ + object = objectDao.getByProperty(GodownEntry.class.getSimpleName() , "warehouseID" , wareHouseId); + } + if(object == null){ + object = objectDao.getByProperty(GodownEntry.class.getSimpleName() , "targetWareHouseId" , wareHouseId); + } + if(object == null){ + object = objectDao.getByProperty(GodownEntryItem.class.getSimpleName() , "warehouseID" , wareHouseId); + } + if(object == null){ + object = objectDao.getByProperty(Invoice.class.getSimpleName() , "warehouseID" , wareHouseId); + } + if(object == null){ + object = objectDao.getByProperty(InvoiceItem.class.getSimpleName() , "wareHouseId" , wareHouseId); + } + if(object == null){ + object = objectDao.getByProperty(StockTakeInfo.class.getSimpleName() , "wareHouseId" , wareHouseId); + } + if(object == null){ + object = objectDao.getByProperty(StockTakeItem.class.getSimpleName() , "wareHouseId" , wareHouseId); + } + if(object == null){ + object = objectDao.getByProperty(ReturnGoodsRecord.class.getSimpleName() , "warehouseID" , wareHouseId); + } + if(object == null){ + object = objectDao.getByProperty(ReturnGoodsItem.class.getSimpleName() , "warehouseID" , wareHouseId); + } + if(object == null){ + object = objectDao.getByProperty(TousseInstance.class.getSimpleName() , "wareHouseId" , wareHouseId); + } + if(object == null){ + object = objectDao.getByProperty(DisposableGoodsStock.class.getSimpleName() , "warehouseID" , wareHouseId); + } + if(object == null){ + object = objectDao.getByProperty(DisposableGoodsBatchStock.class.getSimpleName() , "warehouseID" , wareHouseId); + } + if(object == null){ + object = objectDao.getByProperty(IdentificationOfDisposableGoods.class.getSimpleName() , "warehouseID" , wareHouseId); + } + return object; + } + + /** * 判断仓库是否已经存在,id不为空时判断名字是否与其它仓库名字相同,如果id为空判断名字是否已经存在 * @param wareHouse * @return @@ -147,7 +255,18 @@ */ public int removeWareHouse(List idList){ if(CollectionUtils.isNotEmpty(idList)){ - objectDao.delete(WareHouse.class.getSimpleName(), idList); + List wareHouseList = objectDao.findByIds(WareHouse.class.getSimpleName(), idList); + if(CollectionUtils.isNotEmpty(wareHouseList)){ + for(WareHouse wareHouse : wareHouseList){ + if(getWareHouseFromOtherEntityById(wareHouse.getId()) == null){ + objectDao.delete(wareHouse); + }else{ + throw new RuntimeException("删除失败," + wareHouse.getName() + "在其它实体还有关联数据"); + } + } + }else{ + throw new RuntimeException("未找到仓库,可能已删除。"); + } return idList.size(); } return 0; Index: ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/service/RecyclingRecordListSqlGenerator.java =================================================================== diff -u -r12560 -r12835 --- ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/service/RecyclingRecordListSqlGenerator.java (.../RecyclingRecordListSqlGenerator.java) (revision 12560) +++ ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/service/RecyclingRecordListSqlGenerator.java (.../RecyclingRecordListSqlGenerator.java) (revision 12835) @@ -111,22 +111,22 @@ String tempSql = "(SELECT TOP " + end - + " r.*,p.type FROM RecyclingRecord r left join InvoicePlan p on r.recyclingApplication_id = p.id where r.orgUnitCoding = '" + + " r.*,p.type FROM RecyclingRecord r left join InvoicePlan p on r.recyclingApplication_id = p.id where p.handleDepartCoding = '" + orgUnitCodingFromSupplyRoomConfig + "' and " + filterSql + " order by recyclingTime desc) A"; String tempSql2 = "(SELECT TOP " + (start - 1) - + " r.id FROM RecyclingRecord r left join InvoicePlan p on r.recyclingApplication_id = p.id where r.orgUnitCoding = '" + + " r.id FROM RecyclingRecord r left join InvoicePlan p on r.recyclingApplication_id = p.id where p.handleDepartCoding = '" + orgUnitCodingFromSupplyRoomConfig + "' and " + filterSql + " order by recyclingTime desc)"; sql = "SELECT TOP 20 * FROM " + tempSql + " WHERE id not in " + tempSql2; } else if (DatabaseUtil.isOracle(dbConnection.getDatabase())) { - sql = "SELECT * FROM (SELECT A.*, ROWNUM RN FROM (SELECT r.*,p.type FROM RecyclingRecord r left join InvoicePlan p on r.recyclingApplication_id = p.id where r.orgUnitCoding = '" + sql = "SELECT * FROM (SELECT A.*, ROWNUM RN FROM (SELECT r.*,p.type FROM RecyclingRecord r left join InvoicePlan p on r.recyclingApplication_id = p.id where p.handleDepartCoding = '" + orgUnitCodingFromSupplyRoomConfig + "' and " + filterSql