|
@@ -333,6 +333,7 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
processInspecion.setCarrierId(processInspecion.getLot().getCarrierId());
|
|
|
processInspecion.setCarrierCode(processInspecion.getLot().getCarrierCode());
|
|
|
processInspecion.setDayworkId(daywork.getId());
|
|
|
+ processInspecion.setProductDescription(processInspecion.getLot().getProductDescription());
|
|
|
processInspecion.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
processInspecion.setDayworkItemId(dayworkItem.getId());
|
|
|
processInspecion.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
@@ -501,7 +502,8 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
reject.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
reject.setLotId(processInspecion.getLot().getId());
|
|
|
reject.setDayworkItemId(dayworkItem.getId());
|
|
|
- newRej.setRejectNum(newRej.getRejectNum() + reject.getRejectNum());
|
|
|
+ Long rejectNum = reject.getRejectNum() == null? 0L : reject.getRejectNum();
|
|
|
+ newRej.setRejectNum(newRej.getRejectNum());
|
|
|
newRej.setUserId(user == null ? 0L : user.getUserId());
|
|
|
newRej.setProcessInspectionId(processInspecion.getId());
|
|
|
newRej.setDayworkId(0L);
|
|
@@ -603,7 +605,7 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
return error("未找到该箱号");
|
|
|
}
|
|
|
//查询箱号是否废弃
|
|
|
- BizCarrierReject carrierReject = bizCarrierRejectService.query().eq("carrier_id", carrier.getId()).eq("deleted", 0).one();
|
|
|
+ BizCarrierReject carrierReject = bizCarrierRejectService.query().eq("carrier_id", carrier.getId()).eq("deleted", 0).eq("is_abandoned", 1).last("limit 1").one();
|
|
|
if (carrierReject != null) {
|
|
|
return error("该载具已废弃");
|
|
|
}
|
|
@@ -661,11 +663,16 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
if (detailList.stream().noneMatch(detail -> processCodes.stream().anyMatch(l -> l.trim().equals(detail.getProcessCode())))) {
|
|
|
throw new RuntimeException("该批次不需要外协检查");
|
|
|
}
|
|
|
- if (detailList.stream().noneMatch(detail -> detail.getIsAudit().equals(1) && detail.getStatus().equals(1))) {
|
|
|
- throw new RuntimeException("该批次需要审核通过后才能外协检查");
|
|
|
- }
|
|
|
+// 现在先不考虑 审核通过后才能外协检查限制先放到下一迭代 20240625
|
|
|
+// if (detailList.stream().noneMatch(detail -> detail.getIsAudit().equals(1) && detail.getStatus().equals(1))) {
|
|
|
+// throw new RuntimeException("该批次需要审核通过后才能外协检查");
|
|
|
+// }
|
|
|
detailList = detailList.stream()
|
|
|
- .filter(detail -> processCodes.stream().anyMatch(l -> l.trim().equals(detail.getProcessCode())) && detail.getIsAudit().equals(1) && detail.getStatus().equals(1))
|
|
|
+ .filter(detail -> processCodes.stream().anyMatch(l -> l.trim().equals(detail.getProcessCode())) &&
|
|
|
+ detail.getIsAudit().equals(1)
|
|
|
+// 现在先不考虑 审核通过后才能外协检查限制先放到下一迭代 20240625
|
|
|
+// && detail.getStatus().equals(1)
|
|
|
+ )
|
|
|
.collect(Collectors.toList());
|
|
|
//如果有多道工序,则根据工序的排序找到最后一条
|
|
|
if (detailList.size() > 1) {
|
|
@@ -880,7 +887,17 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
*/
|
|
|
@Log(title = "序检主", businessType = BusinessType.DELETE)
|
|
|
@DeleteMapping("/{ids}")
|
|
|
+ @Transactional
|
|
|
public AjaxResult remove(@PathVariable List<Long> ids) {
|
|
|
+ List<BizProcessInspectionDetail> bizProcessInspectionDetails = processInspectionDetailService.query().in("process_inspection_id", ids).list();
|
|
|
+ List<BizDayworkCarrier> carriers = bizDayworkCarrierService.query().in("process_inspection_id", ids).list();
|
|
|
+ List<BizDayworkItemReject> rejects = bizDayworkItemRejectService.query().in("process_inspection_id", ids).list();
|
|
|
+ List<BizDayworkItemConsult> consults = bizDayworkItemConsultService.query().in("process_inspection_id", ids).list();
|
|
|
+
|
|
|
+ processInspectionDetailService.removeBatchByIds(bizProcessInspectionDetails);
|
|
|
+ bizDayworkItemRejectService.removeBatchByIds(rejects);
|
|
|
+ bizDayworkCarrierService.removeBatchByIds(carriers);
|
|
|
+ bizDayworkItemConsultService.removeBatchByIds(consults);
|
|
|
return toAjax(bizProcessInspecionService.removeBatchByIds(ids));
|
|
|
}
|
|
|
|
|
@@ -896,6 +913,14 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
if (bizProcessInspecion.getStatus().equals(0) && newCarriers.isEmpty()) {
|
|
|
return error("该序检未完成,不能解绑载具");
|
|
|
}
|
|
|
+ List<BizCarrierReject> carrierRejects = bizProcessInspecion.getRejectCarrier();
|
|
|
+ List<BizCarrier> carriers = bizCarrierService.query().in("id", carrierRejects.isEmpty() ?
|
|
|
+ Collections.singletonList(0L) :
|
|
|
+ carrierRejects.stream().map(BizCarrierReject::getCarrierId)
|
|
|
+ .collect(Collectors.toList())).list();
|
|
|
+ carriers.forEach(l -> l.setIsAbandoned(1));
|
|
|
+ bizCarrierService.updateBatchById(carriers);
|
|
|
+ bizCarrierRejectService.saveBatch(carrierRejects);
|
|
|
bizDayworkCarriers.forEach(l -> l.setIsChanged(1));
|
|
|
bizDayworkCarrierService.updateBatchById(bizDayworkCarriers);
|
|
|
if (newCarriers.isEmpty()) {
|