lyfO_o
2021-06-16 0b0d7c1efa03ba43ccd21f9b89b1b7f359db7961
试剂流向:报废试剂
已修改9个文件
328 ■■■■■ 文件已修改
src/main/java/com/nanometer/smartlab/controller/OpeUseFlowInfoController.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/nanometer/smartlab/dao/OpeReagentStatusDao.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/nanometer/smartlab/dao/OpeReagentStatusDao.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/nanometer/smartlab/entity/enumtype/OperateStatus.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/nanometer/smartlab/service/OpeReagentStatusService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/nanometer/smartlab/service/OpeReagentStatusServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/nanometer/smartlab/service/OpeUseFlowService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/nanometer/smartlab/service/OpeUseFlowServiceImpl.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/reagent_user_flow_info.xhtml 227 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/nanometer/smartlab/controller/OpeUseFlowInfoController.java
@@ -7,7 +7,9 @@
import com.nanometer.smartlab.entity.SysUser;
import com.nanometer.smartlab.entity.dto.ApplyListDto;
import com.nanometer.smartlab.exception.BusinessException;
import com.nanometer.smartlab.service.SysUserService;
import com.nanometer.smartlab.util.FacesUtils;
import com.nanometer.smartlab.util.Utils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
@@ -72,6 +74,8 @@
    private List<SysReagent> reagentSelectList;
    private OpeUseFlow selectedOne;
    public List<SysReagent> getReagentSelectList() {
        if (this.reagentSelectList == null) {
@@ -211,6 +215,26 @@
        }
    }
    //报废试剂
    public void scrapReagent(){
        if (this.selectedOne == null) {
            FacesUtils.warn("请选择");
            return;
        }
        try {
            String reagentCode = this.selectedOne.getReagentCode();
            String reagentId = this.selectedOne.getReagent().getId();
            opeUseFlowService.scrapReagent(reagentId, reagentCode, getUserId());
            FacesUtils.warn("操作成功");
        } catch (BusinessException e) {
            FacesUtils.warn(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            FacesUtils.warn("操作失败");
        }
    }
    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }
@@ -243,4 +267,12 @@
    public void setContainerCode(String containerCode) {
        this.containerCode = containerCode;
    }
    public OpeUseFlow getSelectedOne() {
        return selectedOne;
    }
    public void setSelectedOne(OpeUseFlow selectedOne) {
        this.selectedOne = selectedOne;
    }
}
src/main/java/com/nanometer/smartlab/dao/OpeReagentStatusDao.java
@@ -59,4 +59,7 @@
    void updateArticleNumberByRCode(String code, String articleNumber);
    List<Map> selectExportList(Map params);
    OpeReagentStatus getStatus(@Param("reagentId") String reagentId,@Param("reagentCode") String reagentCode);
}
src/main/java/com/nanometer/smartlab/dao/OpeReagentStatusDao.xml
@@ -639,4 +639,12 @@
        </choose>
        order by oa.reagent_code asc
    </select>
    <select id="getStatus" resultMap="OpeReagentStatus">
          select *
        from ope_reagent_status
        where valid_flag = 1
        and reagent_code = #{reagentCode}
        and reagent_id = #{reagentId}
    </select>
</mapper>
src/main/java/com/nanometer/smartlab/entity/enumtype/OperateStatus.java
@@ -3,7 +3,8 @@
import java.util.HashMap;
public enum OperateStatus {
    WAREHOUSEIN(10, "仓库入库"), WAREHOUSEOUT(11, "仓库领用"), LABORATORYIN(0, "试剂柜入库"), TRANSFER(6,"转移");
    WAREHOUSEIN(10, "仓库入库"), WAREHOUSEOUT(11, "仓库领用"), LABORATORYIN(0, "试剂柜入库"), TRANSFER(6,"转移"),
    SCRAP(5, "报废");
    private int key;
    private String text;
src/main/java/com/nanometer/smartlab/service/OpeReagentStatusService.java
@@ -112,4 +112,6 @@
                               String reagentCode, String userId,String labName);
    void exportLabStock2Excel(List<Map> list) throws Exception;
    OpeReagentStatus getStatus(String reagentId, String reagentCode);
}
src/main/java/com/nanometer/smartlab/service/OpeReagentStatusServiceImpl.java
@@ -1129,5 +1129,12 @@
        ExcelUtils.export2Excel(list,"实验室库存",map);
    }
    @Override
    public OpeReagentStatus getStatus(String reagentId, String reagentCode) {
        return opeReagentStatusDao.getStatus(reagentId,reagentCode);
    }
}
src/main/java/com/nanometer/smartlab/service/OpeUseFlowService.java
@@ -57,4 +57,6 @@
    int getApplyInfoSize(String receiptNumber);
    int getOpeUseFlow(OpeUseFlow opeUseFlow);
    void scrapReagent(String reagentId,String reagentCode, String userId);
}
src/main/java/com/nanometer/smartlab/service/OpeUseFlowServiceImpl.java
@@ -8,9 +8,7 @@
import javax.annotation.Resource;
import com.nanometer.smartlab.dao.BaseMetaDao;
import com.nanometer.smartlab.dao.SysLaboratoryContainerDao;
import com.nanometer.smartlab.dao.SysWarehouseContainerDao;
import com.nanometer.smartlab.dao.*;
import com.nanometer.smartlab.entity.*;
import com.nanometer.smartlab.entity.dto.PersonUseDetail;
import com.nanometer.smartlab.entity.enumtype.OperateStatus;
@@ -25,7 +23,6 @@
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.nanometer.smartlab.dao.OpeUseFlowDao;
import com.nanometer.smartlab.entity.enumtype.ArrivalStatus;
import com.nanometer.smartlab.entity.enumtype.SeeFlag;
import com.nanometer.smartlab.exception.AlarmCode;
@@ -59,6 +56,8 @@
    private SysReagentService sysReagentService;
    @Resource
    private BaseMetaDao baseMetaDao;
    @Resource
    private OpeReagentStatusDao opeReagentStatusDao;
    @Transactional(propagation = Propagation.REQUIRED)
@@ -540,4 +539,41 @@
        return opeUseFlowDao.countOpeUseFlow(opeUseFlow);
    }
    @Override
    @Transactional
    public void scrapReagent(String reagentId,String reagentCode, String userId) {
        //1.试剂状态表更新试剂状态为报废
        OpeReagentStatus status = opeReagentStatusService.getStatus(reagentId, reagentCode);
        if (status.getStatus() == ArrivalStatus.SCRAP) {
            throw new BusinessException(ExceptionEnumCode.PARAM_ERR,"该试剂已是报废状态,无法进行操作");
        }
        //报废
        status.setStatus(ArrivalStatus.SCRAP);
        status.setUserId(userId);
        opeReagentStatusDao.updateOpeReagentStatusDao(status);
        //2.插入一条报废的流向记录
        OpeUseFlow useFlow = new OpeUseFlow();
        //获取报废状态id
        Map<String, Object> params = new HashMap<>();
        params.put("groupId", "operate_status");
        params.put("metaKey", String.valueOf(OperateStatus.SCRAP.getKey()));
        List<BaseMeta> baseMetas = baseMetaDao.getBaseMetaList(params);
        useFlow.setOperateState(baseMetas.get(0).getId());
        useFlow.setReagentCode(reagentCode);
        useFlow.setContainerId(status.getContainerId());
        useFlow.setHouseId(status.getHouseId());
        useFlow.setUserId(userId);
        useFlow.setPlace(status.getPlace());
        useFlow.setRemainder(status.getRemainder());
        useFlow.setStoreType(status.getStoreType());
        useFlow.setProject(status.getProjectNum());
        useFlow.setArticleNumber(status.getArticleNumber());
        useFlow.setCreateTime(new Timestamp(new Date().getTime()));
        useFlow.setId(IDUtils.uuid());
        opeUseFlowDao.insertOpeUseFlow(useFlow);
    }
}
src/main/webapp/reagent_user_flow_info.xhtml
@@ -9,6 +9,7 @@
    xmlns:c="http://java.sun.com/jsp/jstl/core">
<head></head>
<ui:composition>
    <h:form id="reagentUseFlowInfoForm">
        <p:panel styleClass="center-header">
            <p:outputLabel styleClass="title" value="试剂流向追踪"></p:outputLabel>
@@ -37,120 +38,16 @@
            </p:panel>
        </p:panel>
        <p:panel styleClass="center-body">
            <p:dialog id="apply-ui" header="领用单" widgetVar="printDialog" appendTo="@(body)" modal="true" resizable="false"
            width="1000">
                <div id="printTarget">
                    <div style=" margin: 10mm 10mm 0mm 2mm;">
                        <h:form id="printDialog">
                            <p:outputPanel style="text-align: center;font-size: 14px;font-weight: 700;">#{opeUseFlowInfoController.printTable['head']}</p:outputPanel>
                            <p:outputPanel style="text-align: center;font-size: 15px;margin: 20px;font-weight: 700;">#{opeUseFlowInfoController.printTable['title']}</p:outputPanel>
                            <div>
                                <div style="display: flex;flex-direction: row;justify-content: flex-end;">
                                    <div style="width: 100px;">单据编号:</div>
                                    <div style="width: 300px;">#{opeUseFlowInfoController.printTable['receiptNumber']}</div>
                                </div>
                            </div>
                            <div style="margin: 10px 0;">
                                <div style="display: inline-flex;">
                                    <div style="width: 100px;margin-left: 10px;">部门:</div>
                                    <div style="width: 300px;">#{opeUseFlowInfoController.printTable['department']}</div>
                                </div>
                                <div style="display: inline-flex;float: right;">
                                    <div style="width: 100px;">日期:</div>
                                    <div style="width: 300px;padding-top: 1px;">
                                        <div>#{opeUseFlowInfoController.printTable['date']}</div>
                                    </div>
                                </div>
                            </div>
                            <div style="margin-bottom: 20px;">
                                <div style="display: inline-flex;">
                                    <div style="width: 100px;margin-left: 10px;">申购人:</div>
                                    <div style="width: 300px;">#{opeUseFlowInfoController.printTable['applyPerson']}</div>
                                </div>
                                <div style="display: inline-flex;float: right;">
                                    <div style="width: 100px;">联系方式:</div>
                                    <div style="width: 300px;">
                                        <div >#{opeUseFlowInfoController.printTable['phone']}</div>
                                    </div>
                                </div>
                            </div>
                            <p:dataTable id="printTB" styleClass="apply-list"
                                         value="#{opeUseFlowInfoController.printTable['applyList']}" var="row" >
                                <p:column headerText="产品编号" width="150px;" style="text-align: center;">
                                    <h:outputText value="#{row.productCode}" />
                                </p:column>
                                <p:column headerText="产品名称" width="150px;" style="text-align: center;">
                                    <h:outputText value="#{row.productName}" />
                                </p:column>
                                <p:column headerText="管制品" width="100px;" style="text-align: center;">
                                    <h:outputText value="#{row.controlProducts}" />
                                </p:column>
                                <p:column headerText="规格型号" width="160px;" style="text-align: center;">
                                    <h:outputText value="#{row.reagentFormat}" />
                                </p:column>
                                <p:column headerText="包装" width="90px;" style="text-align: center;">
                                    <h:outputText value="#{row.mainMetering==null?'':row.mainMetering}" />
                                </p:column>
                                <p:column headerText="数量" width="90px;" style="text-align: center;">
                                    <h:outputText value="#{row.num}" />
                                </p:column>
                                <p:column headerText="备注" width="170px;" style="text-align: center;">
                                    <h:outputText value="#{row.memo}" />
                                </p:column>
                            </p:dataTable>
                            <div style="margin-top: 20px;">
                                <div style="display: flex;flex-direction: row;justify-content: flex-end;">
                                    <div style="width: 100px">签收人:</div>
                                    <div style="width: 300px"></div>
                                </div>
                            </div>
                            <div style="margin: 10px 0">
                                <div style="display: flex;flex-direction: row;justify-content: flex-end;">
                                    <div style="width: 100px">日期:</div>
                                    <div style="width: 300px"></div>
                                </div>
                            </div>
                            <p:panel styleClass="btn  no-print">
                                <div class="div-btn cancel" id="cancel">关闭</div>
                                <div class="div-btn print" id="print">打印</div>
                            </p:panel>
                        </h:form>
                    </div>
                </div>
                <script type="text/javascript" src="resources/js/print.js"/>
                <script type="text/javascript">
                    $(function () {
                        $("#print").on("click", function () {
                            jQuery.print('#printTarget');
                        });
                        $("#cancel").on("click", function () {
                            $("#reagentUseFlowInfoForm\\:apply-ui a").click();
                        })
                    })
                </script>
            </p:dialog>
            <p:panelGrid columns="1" styleClass="btn">
                <p:commandButton value="报废" styleClass="del-btn"  ajax="false" actionListener="#{opeUseFlowInfoController.scrapReagent}" />
            </p:panelGrid>
            <p:dataTable id="reagentUseFlowInfoDataTable" styleClass="data-table"
                paginator="true" paginatorAlwaysVisible="false" paginatorPosition="bottom"
                lazy="true" value="#{opeUseFlowInfoController.dataModel}" var="row"
                selectionMode="single"
                selection="#{opeUseFlowInfoController.selectedOne}"
                rowKey="#{row.id}" emptyMessage="无数据" rows="20" pageLinks="5">
                <p:column headerText="试剂条形码">
                    <h:outputText value="#{row.reagentCode}"></h:outputText>
@@ -211,7 +108,117 @@
<!--                </p:column>-->
            </p:dataTable>
        </p:panel>
    </h:form>
    <p:dialog id="apply-ui" header="领用单" widgetVar="printDialog" appendTo="@(body)" modal="true" resizable="false"
              width="1000">
        <div id="printTarget">
            <div style=" margin: 10mm 10mm 0mm 2mm;">
                <h:form id="printDialog">
                    <p:outputPanel style="text-align: center;font-size: 14px;font-weight: 700;">#{opeUseFlowInfoController.printTable['head']}</p:outputPanel>
                    <p:outputPanel style="text-align: center;font-size: 15px;margin: 20px;font-weight: 700;">#{opeUseFlowInfoController.printTable['title']}</p:outputPanel>
                    <div>
                        <div style="display: flex;flex-direction: row;justify-content: flex-end;">
                            <div style="width: 100px;">单据编号:</div>
                            <div style="width: 300px;">#{opeUseFlowInfoController.printTable['receiptNumber']}</div>
                        </div>
                    </div>
                    <div style="margin: 10px 0;">
                        <div style="display: inline-flex;">
                            <div style="width: 100px;margin-left: 10px;">部门:</div>
                            <div style="width: 300px;">#{opeUseFlowInfoController.printTable['department']}</div>
                        </div>
                        <div style="display: inline-flex;float: right;">
                            <div style="width: 100px;">日期:</div>
                            <div style="width: 300px;padding-top: 1px;">
                                <div>#{opeUseFlowInfoController.printTable['date']}</div>
                            </div>
                        </div>
                    </div>
                    <div style="margin-bottom: 20px;">
                        <div style="display: inline-flex;">
                            <div style="width: 100px;margin-left: 10px;">申购人:</div>
                            <div style="width: 300px;">#{opeUseFlowInfoController.printTable['applyPerson']}</div>
                        </div>
                        <div style="display: inline-flex;float: right;">
                            <div style="width: 100px;">联系方式:</div>
                            <div style="width: 300px;">
                                <div >#{opeUseFlowInfoController.printTable['phone']}</div>
                            </div>
                        </div>
                    </div>
                    <p:dataTable id="printTB" styleClass="apply-list"
                                 value="#{opeUseFlowInfoController.printTable['applyList']}" var="row" >
                        <p:column headerText="产品编号" width="150px;" style="text-align: center;">
                            <h:outputText value="#{row.productCode}" />
                        </p:column>
                        <p:column headerText="产品名称" width="150px;" style="text-align: center;">
                            <h:outputText value="#{row.productName}" />
                        </p:column>
                        <p:column headerText="管制品" width="100px;" style="text-align: center;">
                            <h:outputText value="#{row.controlProducts}" />
                        </p:column>
                        <p:column headerText="规格型号" width="160px;" style="text-align: center;">
                            <h:outputText value="#{row.reagentFormat}" />
                        </p:column>
                        <p:column headerText="包装" width="90px;" style="text-align: center;">
                            <h:outputText value="#{row.mainMetering==null?'':row.mainMetering}" />
                        </p:column>
                        <p:column headerText="数量" width="90px;" style="text-align: center;">
                            <h:outputText value="#{row.num}" />
                        </p:column>
                        <p:column headerText="备注" width="170px;" style="text-align: center;">
                            <h:outputText value="#{row.memo}" />
                        </p:column>
                    </p:dataTable>
                    <div style="margin-top: 20px;">
                        <div style="display: flex;flex-direction: row;justify-content: flex-end;">
                            <div style="width: 100px">签收人:</div>
                            <div style="width: 300px"></div>
                        </div>
                    </div>
                    <div style="margin: 10px 0">
                        <div style="display: flex;flex-direction: row;justify-content: flex-end;">
                            <div style="width: 100px">日期:</div>
                            <div style="width: 300px"></div>
                        </div>
                    </div>
                    <p:panel styleClass="btn  no-print">
                        <div class="div-btn cancel" id="cancel">关闭</div>
                        <div class="div-btn print" id="print">打印</div>
                    </p:panel>
                </h:form>
            </div>
        </div>
        <script type="text/javascript" src="resources/js/print.js"/>
        <script type="text/javascript">
            $(function () {
                $("#print").on("click", function () {
                    jQuery.print('#printTarget');
                });
                $("#cancel").on("click", function () {
                    $("#reagentUseFlowInfoForm\\:apply-ui a").click();
                })
            })
        </script>
    </p:dialog>
</ui:composition>
</html>