|
@@ -1,8 +1,10 @@
|
|
package cn.ezhizao.project.business.product.controller;
|
|
package cn.ezhizao.project.business.product.controller;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.Comparator;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.stream.Collectors;
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
@@ -20,6 +22,7 @@ import cn.ezhizao.project.business.technologicalProcessDetail.service.IBizTechno
|
|
import cn.ezhizao.project.system.domain.SysUser;
|
|
import cn.ezhizao.project.system.domain.SysUser;
|
|
import cn.ezhizao.project.system.service.ISysUserService;
|
|
import cn.ezhizao.project.system.service.ISysUserService;
|
|
import com.baomidou.mybatisplus.annotation.TableField;
|
|
import com.baomidou.mybatisplus.annotation.TableField;
|
|
|
|
+import org.apache.xmlbeans.impl.soap.Detail;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -69,7 +72,8 @@ public class BizProcessInspecionController extends BaseController
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private IBizProductService productService;
|
|
private IBizProductService productService;
|
|
-
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private IBizReturnReceiptDetailService bizReturnReceiptDetailService;
|
|
@Resource
|
|
@Resource
|
|
private IBizProductionPlanDetailService productionPlanDetailService;
|
|
private IBizProductionPlanDetailService productionPlanDetailService;
|
|
/**
|
|
/**
|
|
@@ -250,6 +254,83 @@ public class BizProcessInspecionController extends BaseController
|
|
return success(list);
|
|
return success(list);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 根据箱号查询批次信息
|
|
|
|
+ */
|
|
|
|
+// @PreAuthorize("@ss.hasPermi('business:inspecion:list')")
|
|
|
|
+ @PostMapping("/getLotOutsourcedInfo")
|
|
|
|
+ public AjaxResult getLotOutsourcedInfo(@RequestBody BizDayworkCarrier dayworkCarrier) throws NoSuchFieldException, IllegalAccessException
|
|
|
|
+ {
|
|
|
|
+ //根据箱号查询当前绑定信息
|
|
|
|
+ dayworkCarrier=bizDayworkCarrierService.getByCarrierCode(dayworkCarrier);
|
|
|
|
+ if(dayworkCarrier==null){
|
|
|
|
+ throw new RuntimeException("该箱号未绑定任何批次");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //根据dayworkId查询外协回收信息是否有该批次
|
|
|
|
+ BizReturnReceiptDetail bizReturnReceiptDetail = new BizReturnReceiptDetail();
|
|
|
|
+ bizReturnReceiptDetail.setDayworkId(dayworkCarrier.getDayworkId());
|
|
|
|
+ List<BizReturnReceiptDetail> detailList =bizReturnReceiptDetailService.getList(bizReturnReceiptDetail);
|
|
|
|
+ if(detailList.size()==0){
|
|
|
|
+ throw new RuntimeException("该批次不是外协回收批次");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //根据传过来的工序编码查询是否有该工序
|
|
|
|
+ List<String> processCodes =dayworkCarrier.getProcessCode();
|
|
|
|
+ detailList = detailList.stream()
|
|
|
|
+ .filter(detail -> processCodes.contains(detail.getProcessCode()))
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ if(detailList.size()==0){
|
|
|
|
+ throw new RuntimeException("该批次不需要外协检查");
|
|
|
|
+ }
|
|
|
|
+ //如果有多道工序,则根据工序的排序找到最后一条
|
|
|
|
+ if(detailList.size()>1){
|
|
|
|
+ //按照工序排序
|
|
|
|
+ detailList.sort(Comparator.comparing(BizReturnReceiptDetail::getProcessStepNumber, Comparator.reverseOrder()));
|
|
|
|
+ }
|
|
|
|
+ //根据工序id查询报工信息
|
|
|
|
+ BizDaywork daywork =new BizDaywork();
|
|
|
|
+ daywork.setId(detailList.get(0).getDayworkId());
|
|
|
|
+ daywork.setTechnologicalProcessDetailId(detailList.get(0).getTechnologicalProcessDetailId());
|
|
|
|
+
|
|
|
|
+ List<BizDayworkItem> itemList = bizDayworkItemService.getByDaywork(daywork);
|
|
|
|
+ if(itemList.size()==0){
|
|
|
|
+ throw new RuntimeException("該批次未开始加工");
|
|
|
|
+ }
|
|
|
|
+ BizDayworkItem item = itemList.get(0);
|
|
|
|
+ BizProductionPlanDetail productionPlanDetail = productionPlanDetailService.getById(item.getProductionPlanDetailId());
|
|
|
|
+ BizProduct product = productService.getById(productionPlanDetail.getProductId());
|
|
|
|
+ SysUser user = sysUserService.selectUserById(product.getTechnicianId());
|
|
|
|
+ if(user!=null){
|
|
|
|
+ item.setTechnicianName(user.getNickName());
|
|
|
|
+ item.setTechnicianId(user.getUserId());
|
|
|
|
+ }else{
|
|
|
|
+ item.setTechnicianName("");
|
|
|
|
+ item.setTechnicianId(0L);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //查询是否为正常批次
|
|
|
|
+ BizLot lot=new BizLot();
|
|
|
|
+ lot.setId(item.getLotId());
|
|
|
|
+ lot = bizLotService.getAllList(lot).get(0);
|
|
|
|
+ if(lot.getIsWaste()==1){
|
|
|
|
+ throw new RuntimeException("改批次已批废");
|
|
|
|
+ }
|
|
|
|
+ if(lot.getIsAmend()==1 || lot.getIsWasteRecycling()==1){
|
|
|
|
+ BizLotTechnologicalProcessDetail process = bizLotTechnologicalProcessDetailService.getById(item.getTechnologicalProcessDetailId());
|
|
|
|
+ lot.setProcessAlias(process.getProcessAlias());
|
|
|
|
+ }else{
|
|
|
|
+ BizTechnologicalProcessDetail process = bizTechnologicalProcessDetailService.getById(item.getTechnologicalProcessDetailId());
|
|
|
|
+ lot.setProcessAlias(process.getProcessAlias());
|
|
|
|
+ }
|
|
|
|
+ lot.setAllCarrierName(item.getCarrierName());
|
|
|
|
+ lot.setDayworkItemId(item.getId());
|
|
|
|
+ lot.setCarrierCode(dayworkCarrier.getCarrierCode());
|
|
|
|
+ lot.setCarrierId(dayworkCarrier.getCarrierId());
|
|
|
|
+ lot.setPudName(item.getProdNum()==0?lot.getProductionQuantity():item.getProdNum());
|
|
|
|
+ return success(lot);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据箱号查询批次信息
|
|
* 根据箱号查询批次信息
|