|
@@ -1,5 +1,6 @@
|
|
|
package cn.ezhizao.project.business.controller;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@@ -11,8 +12,11 @@ import cn.ezhizao.framework.aspectj.lang.enums.BusinessType;
|
|
|
import cn.ezhizao.framework.web.controller.BaseController;
|
|
|
import cn.ezhizao.framework.web.domain.AjaxResult;
|
|
|
import cn.ezhizao.framework.web.page.TableDataInfo;
|
|
|
-import cn.ezhizao.project.business.domain.BizProductionPlanDetail;
|
|
|
+import cn.ezhizao.project.business.domain.*;
|
|
|
+import cn.ezhizao.project.business.service.*;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
@@ -21,8 +25,6 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
-import cn.ezhizao.project.business.domain.BizLot;
|
|
|
-import cn.ezhizao.project.business.service.IBizLotService;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -37,6 +39,21 @@ public class BizLotController extends BaseController
|
|
|
{
|
|
|
@Resource
|
|
|
private IBizLotService bizLotService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IBizTechnologicalAmendService bizTechnologicalAmendService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IBizTechnologicalAmendDetailService bizTechnologicalAmendDetailService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IBizTechnologicalWasteRecyclingService bizTechnologicalWasteRecyclingService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IBizTechnologicalWasteRecyclingDetailService bizTechnologicalWasteRecyclingDetailService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IBizTechnologicalProcessDetailService bizTechnologicalProcessDetailService;
|
|
|
@Resource
|
|
|
HttpServletRequest request;
|
|
|
|
|
@@ -78,6 +95,41 @@ public class BizLotController extends BaseController
|
|
|
BizLot lastLot = bizLotService.getLastLot(bizLot);
|
|
|
return success(lastLot);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 查询批次的工序
|
|
|
+ */
|
|
|
+ @PostMapping("getProcess")
|
|
|
+ public AjaxResult getProcess(@RequestBody BizLot bizLot)
|
|
|
+ {
|
|
|
+ //单批单改或多批单改
|
|
|
+ if(bizLot.getIsAmend()==1) {
|
|
|
+ QueryWrapper<BizTechnologicalAmend> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("is_stop",0);
|
|
|
+ queryWrapper.eq("lot_id",bizLot.getId());
|
|
|
+ BizTechnologicalAmend technologicalAmend = bizTechnologicalAmendService.getOne(queryWrapper);
|
|
|
+ QueryWrapper<BizTechnologicalAmendDetail> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.eq("technological_amend_id",technologicalAmend.getId());
|
|
|
+ List<BizTechnologicalAmendDetail> list = bizTechnologicalAmendDetailService.list(wrapper);
|
|
|
+ return success(list);
|
|
|
+ }else{
|
|
|
+ //该批是否废品回用
|
|
|
+ if(bizLot.getIsWasteRecycling() == 1) {
|
|
|
+ QueryWrapper<BizTechnologicalWasteRecycling> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("lot_id",bizLot.getId());
|
|
|
+ BizTechnologicalWasteRecycling wasteRecycling = bizTechnologicalWasteRecyclingService.getOne(queryWrapper);
|
|
|
+ QueryWrapper<BizTechnologicalWasteRecyclingDetail> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.eq("technological_waste_recycling_id",wasteRecycling.getId());
|
|
|
+ List<BizTechnologicalWasteRecyclingDetail> list = bizTechnologicalWasteRecyclingDetailService.list(wrapper);
|
|
|
+ return success(list);
|
|
|
+ }
|
|
|
+ //查原始工艺工序表
|
|
|
+ else {
|
|
|
+ QueryWrapper<BizTechnologicalProcessDetail> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.eq("technological_process_id",bizLot.getTechnologicalProcessId());
|
|
|
+ return success(bizTechnologicalProcessDetailService.list(wrapper));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 查询计划单下所有的批次
|
|
@@ -91,6 +143,16 @@ public class BizLotController extends BaseController
|
|
|
List<BizLot> list = bizLotService.getLotInfo(bizProductionPlanDetail);
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 通过批次号查找批次信息
|
|
|
+ */
|
|
|
+ @PostMapping("/getLotInfoByLotCode")
|
|
|
+ public AjaxResult getLotInfoByLotCode(@RequestBody BizLot bizLot) throws NoSuchFieldException, IllegalAccessException
|
|
|
+ {
|
|
|
+ QueryWrapper<BizLot> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("lot_code",bizLot.getLotCode());
|
|
|
+ return success(bizLotService.getOne(queryWrapper));
|
|
|
+ }
|
|
|
/**
|
|
|
* 导出计划查询列表
|
|
|
*/
|
|
@@ -104,6 +166,68 @@ public class BizLotController extends BaseController
|
|
|
ExcelUtil<BizLot> util = new ExcelUtil<BizLot>(BizLot.class);
|
|
|
util.exportExcel(response, list, "计划查询数据");
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 废品回用
|
|
|
+ */
|
|
|
+ @PostMapping("/addWasteRecycling")
|
|
|
+ @Transactional
|
|
|
+ public AjaxResult addWasteRecycling(@RequestBody BizLot bizLot)
|
|
|
+ {
|
|
|
+ //废品回用保存,首先存废品回用新生成的批次
|
|
|
+ List<BizLot> lotList = new ArrayList<>();
|
|
|
+ for(String item : bizLot.getLotCodeList()) {
|
|
|
+ BizLot bizLot1 = new BizLot();
|
|
|
+ bizLot1.setLotCode(item);
|
|
|
+ bizLot1.setIsWasteRecycling(1L);
|
|
|
+ bizLot1.setProductionPlanDetailId(bizLot.getProductionPlanDetailId());
|
|
|
+ bizLot1.setTechnologicalProcessId(bizLot.getTechnologicalProcessId());
|
|
|
+ bizLot1.setTechnologyVersion(bizLot.getTechnologyVersion());
|
|
|
+ bizLot1.setProductId(bizLot.getProductId());
|
|
|
+ bizLot1.setProductionQuantity(bizLot.getProductionQuantity());
|
|
|
+ bizLot1.setRequisitionDepartmentId(bizLot.getRequisitionDepartmentId());
|
|
|
+ bizLot1.setRequisitionDepartmentName(bizLot.getRequisitionDepartmentName());
|
|
|
+ lotList.add(bizLot1);
|
|
|
+ }
|
|
|
+ bizLotService.saveBatch(lotList);
|
|
|
+ //新增批次存完,存废品回用工艺表
|
|
|
+ List<BizTechnologicalWasteRecycling> technologicalWasteRecyclingList = new ArrayList<>();
|
|
|
+ for (BizLot item : lotList) {
|
|
|
+ BizTechnologicalWasteRecycling bizTechnologicalWasteRecycling = new BizTechnologicalWasteRecycling();
|
|
|
+ bizTechnologicalWasteRecycling.setLotId(item.getId());
|
|
|
+ bizTechnologicalWasteRecycling.setLotCode(item.getLotCode());
|
|
|
+ bizTechnologicalWasteRecycling.setProductionPlanDetailId(bizLot.getProductionPlanDetailId());
|
|
|
+ bizTechnologicalWasteRecycling.setTechnologicalProcessId(bizLot.getTechnologicalProcessId());
|
|
|
+ bizTechnologicalWasteRecycling.setTechnologyVersion(bizLot.getTechnologyVersion());
|
|
|
+ bizTechnologicalWasteRecycling.setProductDescription(bizLot.getProductDescription());
|
|
|
+ bizTechnologicalWasteRecycling.setProductShaftCategory(bizLot.getProcessList().get(0).getProductShaftCategory());
|
|
|
+ bizTechnologicalWasteRecycling.setProductCode(bizLot.getProcessList().get(0).getProductCode());
|
|
|
+ bizTechnologicalWasteRecycling.setProductId(bizLot.getProductId());
|
|
|
+ bizTechnologicalWasteRecycling.setProductShaftCategoryName(bizLot.getProcessList().get(0).getProductShaftCategoryName());
|
|
|
+ technologicalWasteRecyclingList.add(bizTechnologicalWasteRecycling);
|
|
|
+ }
|
|
|
+ bizTechnologicalWasteRecyclingService.saveBatch(technologicalWasteRecyclingList);
|
|
|
+ //废品工艺表存完,存废品工序表
|
|
|
+ List<BizTechnologicalWasteRecyclingDetail> technologicalWasteRecyclingDetailList = new ArrayList<>();
|
|
|
+ for (BizTechnologicalWasteRecycling item : technologicalWasteRecyclingList) {
|
|
|
+ for(BizTechnologicalWasteRecyclingDetail info : bizLot.getProcessList()) {
|
|
|
+ BizTechnologicalWasteRecyclingDetail bizTechnologicalWasteRecyclingDetail = new BizTechnologicalWasteRecyclingDetail();
|
|
|
+ bizTechnologicalWasteRecyclingDetail.setTechnologicalWasteRecyclingId(item.getId());
|
|
|
+ bizTechnologicalWasteRecyclingDetail.setTechnologyVersion(item.getTechnologyVersion());
|
|
|
+ bizTechnologicalWasteRecyclingDetail.setProductId(info.getProductId());
|
|
|
+ bizTechnologicalWasteRecyclingDetail.setProductCode(info.getProductCode());
|
|
|
+ bizTechnologicalWasteRecyclingDetail.setProcessStepNumber(info.getProcessStepNumber());
|
|
|
+ bizTechnologicalWasteRecyclingDetail.setProcessId(info.getProcessId());
|
|
|
+ bizTechnologicalWasteRecyclingDetail.setProcessKey(info.getProcessKey());
|
|
|
+ bizTechnologicalWasteRecyclingDetail.setProcessCode(info.getProcessCode());
|
|
|
+ bizTechnologicalWasteRecyclingDetail.setProcessAlias(info.getProcessAlias());
|
|
|
+ bizTechnologicalWasteRecyclingDetail.setProductShaftCategory(info.getProductShaftCategory());
|
|
|
+ bizTechnologicalWasteRecyclingDetail.setProductShaftCategoryName(info.getProductShaftCategoryName());
|
|
|
+ bizTechnologicalWasteRecyclingDetail.setProductDescription(info.getProductDescription());
|
|
|
+ technologicalWasteRecyclingDetailList.add(bizTechnologicalWasteRecyclingDetail);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return success(bizTechnologicalWasteRecyclingDetailService.saveBatch(technologicalWasteRecyclingDetailList));
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 获取计划查询详细信息
|