Enford 5 лет назад
Родитель
Сommit
886dfadd50

+ 100 - 0
src/main/java/com/jeeplus/modules/act/service/ActTaskService.java

@@ -6,6 +6,7 @@ package com.jeeplus.modules.act.service;
 import java.io.InputStream;
 import java.util.*;
 
+import com.jeeplus.common.utils.DateUtils;
 import com.jeeplus.common.utils.SpringContextHolder;
 import com.jeeplus.modules.oa.entity.OaNotify;
 import com.jeeplus.modules.oa.entity.OaNotifyRecord;
@@ -16,6 +17,10 @@ import com.jeeplus.modules.sg.managementcenter.activiti.entity.Construction;
 import com.jeeplus.modules.sg.managementcenter.activiti.entity.Disclose;
 import com.jeeplus.modules.sg.managementcenter.activiti.service.ConstructionService;
 import com.jeeplus.modules.sg.managementcenter.activiti.utils.MyActiviUtils;
+import com.jeeplus.modules.sg.managementcenter.materialinfo.entity.MaterialInfo;
+import com.jeeplus.modules.sg.managementcenter.materialinfo.mapper.MaterialInfoMapper;
+import com.jeeplus.modules.sg.managementcenter.materialproject.entity.MaterialProject;
+import com.jeeplus.modules.sg.managementcenter.materialproject.mapper.MaterialProjectMapper;
 import com.jeeplus.modules.sg.managementcenter.project.entity.Project;
 import com.jeeplus.modules.sg.managementcenter.project.entity.Project1;
 import com.jeeplus.modules.sg.materialmodule.activiti.entity.MaterialModule;
@@ -121,6 +126,15 @@ public class ActTaskService extends BaseService {
     private OaNotifyService oaNotifyService;
     @Autowired
     private PickIngService pickIngService;
+    @Autowired
+    private ActProcessService actProcessService;
+    @Autowired
+    private ActTaskService actTaskService;
+
+    @Autowired
+    private MaterialProjectMapper materialProjectMapper;
+    @Autowired
+    private MaterialInfoMapper materialInfoMapper;
 
     /**
      * 获取待办任务列表
@@ -2545,6 +2559,92 @@ public class ActTaskService extends BaseService {
      * @param act
      */
     @Transactional(readOnly = false)
+    public void materialReport(Act act,String selectNumber,String reserveName) {
+        // 设置意见
+        act.setComment(("yes".equals(act.getFlag()) ? "[同意] " : "[驳回] ") + act.getComment());
+        act.preUpdate();
+        // 对不同环节的业务逻辑进行操作
+        String taskDefKey = act.getTaskDefKey();
+        // 提交流程任务
+        Map<String, Object> vars = Maps.newHashMap();
+        vars.put("person", "shenc2");
+        PickApplication pickApplication = new PickApplication();
+        pickApplication.preInsert();
+        pickApplication.setProjectId(reserveName);
+        //保存流程定义
+        showListService.newSave(pickApplication);
+        ProcessDefinition p = actProcessService.getProcessDefinition(act.getProcDefId());
+        String title = UserUtils.getUser().getName() + "在" + DateUtils.getDateTime() + "发起" + p.getName();
+        String procInsId = actTaskService.startProcessNew(p.getKey(), "md_picking_application", pickApplication.getId(), title, vars);
+        List<ShowList> showLists = MyActiviUtils.finaList(selectNumber);
+        for (ShowList a : showLists) {
+            a.preInsert();
+            a.setProcInsId(procInsId);
+            a.setReserveName(reserveName);
+        }
+        pickIngService.processTemReportList(showLists);
+        //complete(act.getTaskId(), act.getProcInsId(), act.getComment(), vars);
+    }
+
+    /**
+     * 保存审核意见
+     *
+     * @param act
+     */
+    @Transactional(readOnly = false)
+    public void materialReportBillOff(Act act) {
+        // 设置意见
+        act.setComment(("yes".equals(act.getFlag()) ? "[同意] " : "[驳回] ") + act.getComment());
+        act.preUpdate();
+        // 对不同环节的业务逻辑进行操作
+        String taskDefKey = act.getTaskDefKey();
+        // 提交流程任务
+        Map<String, Object> vars = Maps.newHashMap();
+        complete(act.getTaskId(), act.getProcInsId(), act.getComment(), vars);
+
+        //获取当前流程的材料数据
+        List<ShowList> procInsIdMaterialReport = pickIngService.findProcInsIdMaterialReport(act.getProcInsId());
+        //赋值
+        List<MaterialProject> materialProjects = new ArrayList<MaterialProject>();
+        List<MaterialInfo> materialInfos = new ArrayList<MaterialInfo>();
+        MaterialProject materialProject = null;
+        MaterialInfo materialInfo = null;
+        String reserveProjectName = "";
+        for (ShowList showList:procInsIdMaterialReport){
+            //获取储备名称名字
+            reserveProjectName = showList.getReserveName();
+            //获取明细数据(此处可优化为反射)
+            materialInfo = new MaterialInfo();
+            materialInfo.setProjectName(showList.getReserveName());//项目名称
+            materialInfo.setMaterialCode(showList.getMaterialCode());//物料编码
+            materialInfo.setMaterialName(showList.getMaterialDescription());//物料描述
+            materialInfo.setExtendDescription(showList.getExtensionDescription());//扩展描述
+            materialInfo.setUnit(showList.getMdUnits());//单位
+            materialInfo.setTotalCount(showList.getMdTotalAmount());//总量
+            materialInfo.setWeightTon(showList.getMdSingleWeight());//单重kg
+            materialInfo.setSupplyType(showList.getMdTheParty());//甲乙供
+            materialInfo.setNote(showList.getMdText());//备注
+            materialInfo.preInsert();
+            materialInfos.add(materialInfo);
+        }
+        materialProject = new MaterialProject();
+        materialProject.setReserveProjectName(reserveProjectName);
+        materialProject.preInsert();
+        materialProjects.add(materialProject);
+        ////添加年度物料上报统计
+        materialProjectMapper.insertList(materialProjects);
+        //添加月度物资上报明细
+        materialInfoMapper.insertList(materialInfos);
+        //根据流程删除临时表
+        pickIngService.deleteProcInsIdMaterialReport(act.getProcInsId());
+    }
+
+    /**
+     * 保存审核意见
+     *
+     * @param act
+     */
+    @Transactional(readOnly = false)
     public void managerExam(Act act) {
         // 设置意见
         act.setComment(("yes".equals(act.getFlag()) ? "[同意] " : "[驳回] ") + act.getComment());

+ 33 - 0
src/main/java/com/jeeplus/modules/act/web/ActTaskController.java

@@ -33,6 +33,7 @@ import com.jeeplus.modules.sg.managementcenter.activiti.utils.MyActiviUtils;
 import com.jeeplus.modules.sg.managementcenter.constructionProject.entity.ConstructionProject;
 import com.jeeplus.modules.sg.managementcenter.project.service.ProjectService;
 import com.jeeplus.modules.sg.materialmodule.activiti.service.MaterialModuleService;
+import com.jeeplus.modules.sg.picking.activiti.entity.PickApplication;
 import com.jeeplus.modules.sg.picking.activiti.entity.ShowList;
 import com.jeeplus.modules.sg.picking.activiti.service.PickIngService;
 import com.jeeplus.modules.sg.settActivi.service.SettActiviService;
@@ -1333,6 +1334,38 @@ public class ActTaskController extends BaseController {
         return j;
     }
 
+    //开具设计清单
+    @ResponseBody
+    @RequestMapping(value = "materialReport")
+    public AjaxJson materialReport(Act act, String selectNumber,String reserveName) {
+        AjaxJson j = new AjaxJson();
+        try {
+            String comment = URLDecoder.decode(act.getComment(), "UTF-8");
+            act.setComment(comment);
+            actTaskService.materialReport(act,selectNumber,reserveName);
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+        j.setMsg("审批成功");
+        return j;
+    }
+
+    //审核材料清单
+    @ResponseBody
+    @RequestMapping(value = "materialReportBillOff")
+    public AjaxJson materialReportBillOff(Act act, String selectNumber,String reserveName) {
+        AjaxJson j = new AjaxJson();
+        try {
+            String comment = URLDecoder.decode(act.getComment(), "UTF-8");
+            act.setComment(comment);
+            actTaskService.materialReportBillOff(act);
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+        j.setMsg("审批成功");
+        return j;
+    }
+
     /**
      * 审批
      *