| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.faces.context.FacesContext; |
| | | import javax.faces.event.ActionListener; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | |
| | | public void setProductSn(String productSn) { |
| | | this.productSn = productSn; |
| | | } |
| | | |
| | | public void openUpdateSafetyNumDialog() { |
| | | if (this.selectedList == null |
| | | || this.selectedList.size() == 0) { |
| | | FacesUtils.warn("请选择数据。"); |
| | | return; |
| | | } |
| | | if (this.selectedList.size() > 1) { |
| | | FacesUtils.warn("只能选择一个数据进行修改。"); |
| | | return; |
| | | } |
| | | this.sysReagent = this.sysReagentService.getSysReagent(this.selectedList.get(0).getId()); |
| | | if (this.sysReagent.getType() != 1) { |
| | | FacesUtils.warn("只能选择试剂设置安全库存。"); |
| | | return; |
| | | } |
| | | RequestContext.getCurrentInstance().execute("PF('dialog-setSafetynum').show()"); |
| | | } |
| | | |
| | | public void updateSafetyNum(){ |
| | | if (this.sysReagent.getSafetynum() == null) { |
| | | FacesUtils.warn("请输入安全库存。"); |
| | | return; |
| | | } |
| | | sysReagentService.updateSafetyNum(this.sysReagent); |
| | | FacesUtils.warn("修改成功。"); |
| | | RequestContext.getCurrentInstance().execute("PF('dialog-setSafetynum').hide()"); |
| | | |
| | | } |
| | | } |
| | |
| | | List<OpeWarehouseReserve> selectWarehouseByRidAndArtiNumberAndWid(Map params); |
| | | |
| | | void updateBtReserve(String id, Integer useNum); |
| | | |
| | | Integer countByReagentId(String id); |
| | | } |
| | |
| | | |
| | | order by oa.update_time,oa.reserve |
| | | </select> |
| | | <select id="countByReagentId" resultType="java.lang.Integer"> |
| | | select ifnull(sum(owr.reserve),0) |
| | | from ope_warehouse_reserve as owr |
| | | where owr.reserve > 0 |
| | | and owr.reagent_id = #{id} |
| | | group by owr.reagent_id |
| | | </select> |
| | | |
| | | <update id="updateByReId" parameterType="java.util.Map"> |
| | | update ope_warehouse_reserve set reagent_id=#{newReId} where reagent_id=#{oldReId} |
| | |
| | | package com.nanometer.smartlab.dao; |
| | | |
| | | import com.nanometer.smartlab.entity.SysReagent; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.dao.DataAccessException; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | String getReagentUnitByReagentId(String reagentId); |
| | | |
| | | List<SysReagent> getReagent(Map params); |
| | | |
| | | List<SysReagent> selectReagentSafetyNum(); |
| | | |
| | | void updateSafetyNum(@Param("id") String id, @Param("safetynum") Integer safetynum); |
| | | } |
| | |
| | | <result property="type" column="type"></result> |
| | | <result property="unitName" column="unitName"></result> |
| | | <result property="formatName" column="formatName"></result> |
| | | <result property="safetynum" column="safetynum"></result> |
| | | </resultMap> |
| | | |
| | | <sql id="queryWhereSql"> |
| | |
| | | </if> |
| | | |
| | | </select> |
| | | <select id="selectReagentSafetyNum" resultMap="SysReagent"> |
| | | select |
| | | sr.id, |
| | | sr.safetynum, |
| | | sr.name, |
| | | sr.main_metering, |
| | | bm1.meta_value reagent_unit, |
| | | bm2.meta_value reagent_type, |
| | | bm3.meta_value reagent_format, |
| | | bm4.meta_value product_home, |
| | | ss.meta_value as product_home_name, |
| | | bm.meta_value as control_products_name, |
| | | supplier.name as supplierName |
| | | from sys_reagent as sr |
| | | left join base_meta as ss on sr.product_home = ss.id |
| | | left join base_meta bm on bm.id = sr.control_products |
| | | left join sys_supplier supplier on supplier.id = sr.supplier_id |
| | | left join base_meta bm1 on bm1.id = sr.reagent_unit |
| | | left join base_meta bm2 on bm2.id = sr.reagent_type |
| | | left join base_meta bm3 on bm3.id = sr.reagent_format |
| | | left join base_meta bm4 on bm4.id = sr.product_home |
| | | where sr.valid_flag = 1 |
| | | and sr.type = 1 |
| | | and safetynum > 0 |
| | | </select> |
| | | |
| | | |
| | | <insert id="insertSysReagent" parameterType="com.nanometer.smartlab.entity.SysReagent"> |
| | | <insert id="insertSysReagent" parameterType="com.nanometer.smartlab.entity.SysReagent"> |
| | | insert into sys_reagent(id, name, cas, reagent_type, reagent_character, supplier_id, reagent_format, main_metering, reagent_unit, price, per_box, memo, valid_flag, create_time, update_time,deadline, product_sn, dangerous_flag,control_products,product_home,type) |
| | | values (#{id}, #{name}, #{cas}, #{reagentType}, #{reagentCharacter}, #{supplierId}, #{reagentFormat}, #{mainMetering}, #{reagentUnit}, #{price}, #{perBox}, #{memo}, 1, now(), now(),#{deadline}, #{productSn}, #{dangerousFlag},#{controlProducts},#{productHome},#{type}) |
| | | </insert> |
| | |
| | | #{item} |
| | | </foreach> |
| | | </update> |
| | | <update id="updateSafetyNum"> |
| | | update sys_reagent |
| | | set safetynum = #{safetynum} |
| | | where id = #{id} |
| | | </update> |
| | | </mapper> |
| | |
| | | |
| | | List<Map> getExportUserList(@Param("arp") String arp,@Param("name") String name, @Param("departmentName") String departmentName, |
| | | @Param("project") String project,@Param("company") String company); |
| | | |
| | | List<String> getLibrarianEmail(); |
| | | |
| | | } |
| | |
| | | </where> |
| | | order by su.arp ASC |
| | | </select> |
| | | <select id="getLibrarianEmail" resultType="java.lang.String"> |
| | | |
| | | select su.email |
| | | from sys_user as su |
| | | left join base_role as br on br.id = su.role_id |
| | | where br.name = '库管员' |
| | | and su.email is not null |
| | | and su.email != '' |
| | | </select> |
| | | <update id="updateUserPointBySelective" parameterType="java.util.Map"> |
| | | update sys_user set point=#{point} |
| | | <where> |
| | |
| | | package com.nanometer.smartlab.email; |
| | | |
| | | import com.nanometer.smartlab.entity.EmailStatus; |
| | | import com.nanometer.smartlab.entity.OpeWarehouseReserve; |
| | | import com.nanometer.smartlab.entity.SysReagent; |
| | | import com.nanometer.smartlab.entity.enumtype.EmailSendStatus; |
| | | import com.nanometer.smartlab.exception.BusinessException; |
| | |
| | | private OpeOrderService opeOrderService; |
| | | |
| | | private static Logger logger = Logger.getLogger(EmailSendSchedule.class); |
| | | |
| | | @Resource |
| | | private SysReagentService sysReagentService; |
| | | @Resource |
| | | private OpeWarehouseReserveService opeWarehouseReserveService; |
| | | @Resource |
| | | private SysUserService userService; |
| | | |
| | | @Scheduled(fixedDelayString = "${emailSend.schedule.delay}") |
| | | public void EmailSendSchedule(){ |
| | |
| | | |
| | | |
| | | // @Scheduled(cron = "0/5 * * * * ?") //每隔5秒执行一次 |
| | | @Scheduled(cron = "0 0 8 * * ?") //每天8点执行一次 |
| | | @Scheduled(cron = "0 0/3 * * * ?") //每天8点执行一次 |
| | | public void EmailSendStock(){ |
| | | List<String> revicerList = new ArrayList<>(); |
| | | |
| | | //收件人为人员角色为库管员的邮箱 |
| | | List<String> revicerList = userService.getLibrarianEmail(); |
| | | //先查试剂表 安全库存大于0,然后去查库存,实际库存小于安全库存的列表 |
| | | List<SysReagent> sysReagentList = new ArrayList<>(); |
| | | |
| | | |
| | | //已经填写安全库存的试剂 |
| | | List<SysReagent> alreadyFillIn = sysReagentService.selectReagentSafetyNum(); |
| | | if (alreadyFillIn.size() > 0) { |
| | | for (SysReagent reagent : alreadyFillIn) { |
| | | int actualNum = opeWarehouseReserveService.countByReagentId(reagent.getId()); |
| | | if (reagent.getSafetynum() > actualNum) { |
| | | reagent.setActualnum(actualNum); |
| | | sysReagentList.add(reagent); |
| | | } |
| | | } |
| | | } |
| | | StringBuffer content = new StringBuffer("<html><body>"); |
| | | content.append("<div style=\"line-height:1.7;color:#000000;font-size:14px;font-family:Arial\">"); |
| | | content.append("<table border=\"1\">"); |
| | |
| | | content.append("<td>"+sysReagent.getName()+"</td>"); |
| | | content.append("<td>"+sysReagent.getProductSn()+"</td>"); |
| | | content.append("<td>"+sysReagent.getCas()+"</td>"); |
| | | content.append("<td>"+sysReagent.getReagentType()+"</td>"); |
| | | |
| | | content.append("<td>"+sysReagent.getReagentType()+"</td>");// |
| | | content.append("<td>"+sysReagent.getSupplierName()+"</td>"); |
| | | |
| | | content.append("<td>"+sysReagent.getProductHomeName()+"</td>"); |
| | | content.append("<td>"+sysReagent.getReagentFormat()+"</td>"); |
| | | content.append("<td>"+sysReagent.getReagentUnit()+"</td>"); |
| | | //content.append("<td>"+sysReagent+"</td>");安全库存 |
| | | //content.append("<td>"+sysReagent+"</td>");实际库存 |
| | | |
| | | content.append("<td>"+sysReagent.getReagentFormat()+"</td>");// |
| | | |
| | | content.append("<td>"+sysReagent.getReagentUnit()+"</td>");// |
| | | content.append("<td>"+sysReagent.getSafetynum()+"</td>"); |
| | | content.append("<td>"+sysReagent.getActualnum()+"</td>"); |
| | | content.append("</tr>"); |
| | | } |
| | | content.append("</tbody></table></div>"); |
| | | content.append("</body></html>"); |
| | | |
| | | try { |
| | | EmailSend.sendArrivalEmail(revicerList,content.toString()); |
| | | // EmailSend.sendArrivalEmail(revicerList,content.toString()); |
| | | // 发送成功,更新邮件发送状态为:已发送 |
| | | } catch (BusinessException e) { |
| | | // 发送失败,更新邮件发送状态为:发送失败 |
| | |
| | | private String formatName; |
| | | |
| | | private String favor; |
| | | private Integer safetynum; |
| | | private Integer actualnum; |
| | | |
| | | |
| | | public void change(){ |
| | |
| | | public void setControlProducts(String controlProducts) { |
| | | this.controlProducts = controlProducts; |
| | | } |
| | | |
| | | public Integer getSafetynum() { |
| | | return safetynum; |
| | | } |
| | | |
| | | public void setSafetynum(Integer safetynum) { |
| | | this.safetynum = safetynum; |
| | | } |
| | | |
| | | public Integer getActualnum() { |
| | | return actualnum; |
| | | } |
| | | |
| | | public void setActualnum(Integer actualnum) { |
| | | this.actualnum = actualnum; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | List<OpeWarehouseReserve> selectWarehouseByRidAndArticleNumberAndWarehouse(String id, String articleNumber, String warehouseId); |
| | | |
| | | void updateBtReserve(String id,Integer useNum); |
| | | |
| | | //根据试剂Id查找当前库存 |
| | | int countByReagentId(String id); |
| | | } |
| | |
| | | opeWarehouseReserveDao.updateBtReserve(id, useNum); |
| | | } |
| | | |
| | | @Override |
| | | @Override |
| | | public int countByReagentId(String id) { |
| | | int num = 0; |
| | | if (opeWarehouseReserveDao.countByReagentId(id) != null) { |
| | | num = opeWarehouseReserveDao.countByReagentId(id); |
| | | } |
| | | return num; |
| | | } |
| | | |
| | | @Override |
| | | public void btWarehouseReserveReduce(List<OpeApplyReserve> opeList) { |
| | | if (opeList.size() < 1) { |
| | | return; |
| | |
| | | String getReagentUnitByReagentId(String reagentId); |
| | | |
| | | List<SysReagent> getReagent(String name, String cas, String factory, String specifications, String packing); |
| | | |
| | | List<SysReagent> selectReagentSafetyNum(); |
| | | |
| | | void updateSafetyNum(SysReagent sysReagent); |
| | | |
| | | } |
| | |
| | | return sysReagentDao.getReagent(params); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysReagent> selectReagentSafetyNum() { |
| | | |
| | | return sysReagentDao.selectReagentSafetyNum(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateSafetyNum(SysReagent sysReagent) { |
| | | sysReagentDao.updateSafetyNum(sysReagent.getId(), sysReagent.getSafetynum()); |
| | | } |
| | | |
| | | |
| | | @Transactional(propagation = Propagation.REQUIRED) |
| | | public int getSysReagentTotalCount(String name, String cas, String supplierId,Integer type) { |
| | |
| | | List<Map> getExportUserList(String arp, String name, String departmentName, String project, String company); |
| | | |
| | | void exportUser2Excel(List<Map> list)throws Exception; |
| | | |
| | | List<String> getLibrarianEmail(); |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | //获取库管员邮箱 |
| | | @Override |
| | | public List<String> getLibrarianEmail() { |
| | | return sysUserDao.getLibrarianEmail(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | </p:panelGrid> |
| | | </p:panel> |
| | | <p:panel styleClass="center-body"> |
| | | <p:panelGrid columns="7" styleClass="btn"> |
| | | <p:panelGrid columns="8" styleClass="btn"> |
| | | <p:commandButton value="新建" styleClass="new-btn" |
| | | process="@this" |
| | | actionListener="#{reagentMngController.onNewBtnClick}" |
| | |
| | | actionListener="#{reagentMngController.onDeleteBtnClick}" |
| | | update="@form"> |
| | | <p:confirm header="确认" message="确认操作?"></p:confirm> |
| | | </p:commandButton> |
| | | <p:commandButton value="安全库存" styleClass="del-btn" |
| | | process="@form" |
| | | actionListener="#{reagentMngController.openUpdateSafetyNumDialog}" |
| | | update=":dialogForm-safetynum"> |
| | | </p:commandButton> |
| | | <p:commandButton value="试剂导入" styleClass="import-btn" onclick="importReagent()" |
| | | ></p:commandButton> |
| | |
| | | <p:column headerText="每箱数量"> |
| | | <h:outputText value="#{row.perBox}"></h:outputText> |
| | | </p:column> |
| | | <p:column headerText="安全库存" rendered="#{reagentMngController.type == 1}"> |
| | | <h:outputText value="#{row.safetynum}" ></h:outputText> |
| | | </p:column> |
| | | <!-- <p:column headerText="库存">--> |
| | | <!-- <h:outputText value="#{row.reserve}"></h:outputText>--> |
| | | <!-- </p:column>--> |
| | |
| | | </p:panel> |
| | | </h:form> |
| | | </p:dialog> |
| | | |
| | | <p:dialog modal="true" header="设置安全库存" appendTo="@(body)" |
| | | id="dialog-setSafetynum" widgetVar="dialog-setSafetynum" |
| | | resizable="false" width="1000"> |
| | | <h:form id="dialogForm-safetynum"> |
| | | <p:panelGrid styleClass="content2 grid-padding-bottom2"> |
| | | <p:row> |
| | | <p:column> |
| | | <p:outputLabel value="试剂名称"/> |
| | | </p:column> |
| | | <p:column> |
| | | <p:inputText value="#{reagentMngController.sysReagent.name}" |
| | | maxlength="100" |
| | | disabled="true" /> |
| | | </p:column> |
| | | <p:column> |
| | | <p:outputLabel value="CAS"/> |
| | | </p:column> |
| | | <p:column> |
| | | <p:inputText value="#{reagentMngController.sysReagent.cas}" |
| | | maxlength="100" |
| | | disabled="true"/> |
| | | </p:column> |
| | | </p:row> |
| | | <p:row> |
| | | <p:column> |
| | | <p:outputLabel value="产品编号"/> |
| | | </p:column> |
| | | <p:column> |
| | | <p:inputText value="#{reagentMngController.sysReagent.productSn}" |
| | | maxlength="100" |
| | | disabled="true"/> |
| | | |
| | | </p:column> |
| | | |
| | | <p:column> |
| | | <p:outputLabel value="安全库存"/> |
| | | </p:column> |
| | | <p:column> |
| | | <p:inputNumber value="#{reagentMngController.sysReagent.safetynum}" |
| | | minValue="0" |
| | | decimalPlaces="0" |
| | | maxlength="100"/> |
| | | |
| | | </p:column> |
| | | </p:row> |
| | | </p:panelGrid> |
| | | <p:panel styleClass="btn"> |
| | | <p:commandButton value="保存" actionListener="#{reagentMngController.updateSafetyNum}" |
| | | process="@form" update=":reagentMngForm:reagentMngDataTable"> |
| | | <p:confirm header="确认" message="确认操作?"/> |
| | | </p:commandButton> |
| | | </p:panel> |
| | | </h:form> |
| | | </p:dialog> |
| | | </ui:composition> |
| | | </html> |