|
@@ -110,6 +110,8 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
private IBizProductionResourceGroupService bizProductionResourceGroupService;
|
|
|
@Resource
|
|
|
private IBizInspectionStandardsCheckService bizInspectionStandardsCheckService;
|
|
|
+ @Resource
|
|
|
+ private IBizInspectionChamberService bizInspectionChamberService;
|
|
|
|
|
|
final private String processInspectionNoKey = "processInspectionCode";
|
|
|
|
|
@@ -738,7 +740,7 @@ public TableDataInfo examineList(@RequestBody BizProcessInspecion bizProcessInsp
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
- @PostMapping("/saveOutsourcedInspecion")
|
|
|
+ //@PostMapping("/saveOutsourcedInspecion")
|
|
|
public AjaxResult saveOutsourcedInspectionV3(@RequestBody BizProcessInspecion processInspecion) throws NoSuchFieldException, IllegalAccessException {
|
|
|
// // 判断是否已有未确认外协检查
|
|
|
// if (bizProcessInspecionService.query().eq("outsource_order_detail_id", processInspecion.getOutsourceOrderDetailId()).eq("status", 0).count() > 0) {
|
|
@@ -916,6 +918,261 @@ public TableDataInfo examineList(@RequestBody BizProcessInspecion bizProcessInsp
|
|
|
dayworkItem.setIsProcessInspection(1);
|
|
|
return success(bizDayworkItemService.saveOrUpdate(dayworkItem) && (consults.isEmpty() || bizDayworkItemConsultService.saveOrUpdateBatch(consults)));
|
|
|
}
|
|
|
+ @Transactional
|
|
|
+ @PostMapping("/saveOutsourcedInspecion")
|
|
|
+ public AjaxResult saveOutsourcedInspectionV4(@RequestBody BizProcessInspecion processInspecion) throws NoSuchFieldException, IllegalAccessException {
|
|
|
+// // 判断是否已有未确认外协检查
|
|
|
+// if (bizProcessInspecionService.query().eq("outsource_order_detail_id", processInspecion.getOutsourceOrderDetailId()).eq("status", 0).count() > 0) {
|
|
|
+// return error("已有未完成外协检查单。");
|
|
|
+// }
|
|
|
+ //根据lot信息保存序检表
|
|
|
+ BizDaywork daywork = bizDayworkService.query().eq("lot_code", processInspecion.getLot().getLotCode()).one();
|
|
|
+ BizProduct product = bizProductService.getById(processInspecion.getLot().getProductId());
|
|
|
+ SysUser technicianUser = sysUserService.selectUserById(product.getTechnicianId());
|
|
|
+ BizDayworkItem dayworkItem = bizDayworkItemService.getById(processInspecion.getLot().getDayworkItemId());
|
|
|
+ BizReturnReceiptDetail bizReturnReceiptDetail = bizReturnReceiptDetailService.query().eq("daywork_id", dayworkItem.getDayworkId()).eq("technological_process_detail_id", dayworkItem.getTechnologicalProcessDetailId()).eq("deleted", 0).one();
|
|
|
+
|
|
|
+ SysUser user = sysUserService.selectUserById(processInspecion.getUser().getUserId());
|
|
|
+
|
|
|
+ // 判断是否已经进行过质检
|
|
|
+ BizProcessInspecion previousItem = bizProcessInspecionService.query().eq("outsource_order_detail_id", bizReturnReceiptDetail.getOutsourceDetailId()).isNull("recheck_date").ne("id", processInspecion.getId() == null ? 0L : processInspecion.getId()).one();
|
|
|
+ BizOutsourcedOrderDetail outsourceOrderDetail = bizOutsourcedOrderDetailService.query().eq("id", bizReturnReceiptDetail.getOutsourceDetailId()).one();
|
|
|
+
|
|
|
+// if (previousItem != null) {
|
|
|
+// if (processInspecion.getId() == null) {
|
|
|
+// previousItem.setRecheckDate(DateTime.now().toJdkDate());
|
|
|
+// }
|
|
|
+// previousItem.setIsInspectionCarrierChanged(0);
|
|
|
+// previousItem.setInspectionCarrierChangedTime(null);
|
|
|
+// previousItem.setStatus(processInspecion.getStatus());
|
|
|
+// previousItem.setRejectNum(processInspecion.getRejectNum());
|
|
|
+// previousItem.setExaminingNum(processInspecion.getExaminingNum());
|
|
|
+// previousItem.setDisqualificationNum(processInspecion.getDisqualificationNum());
|
|
|
+// } else {
|
|
|
+// previousItem = new BizProcessInspecion(processInspecion);
|
|
|
+ String beginCode = "WDD" + DateTime.now().toString("yyMM");
|
|
|
+ String previous = redisCache.hasKey(processInspectionNoKey) ? redisCache.getCacheObject(processInspectionNoKey) : "";
|
|
|
+ String codeValue = "";
|
|
|
+ if (previous.isEmpty() || !previous.startsWith(beginCode)) {
|
|
|
+ previous = (beginCode + "000001");
|
|
|
+ } else {
|
|
|
+ codeValue = previous;
|
|
|
+ int lastFourDigits = Integer.parseInt(codeValue.substring(7, 13));
|
|
|
+ lastFourDigits += 1; // 加1
|
|
|
+ codeValue = codeValue.substring(0, 7) + String.format("%06d", lastFourDigits);
|
|
|
+ previous = codeValue;
|
|
|
+ }
|
|
|
+ processInspecion.setOutsourcedInspectionNo(previous);
|
|
|
+ redisCache.setCacheObject(processInspectionNoKey, previous);
|
|
|
+// }
|
|
|
+ processInspecion.setReturnReceiptDetailId(bizReturnReceiptDetail.getId());
|
|
|
+// processInspecion.setUserId(user == null ? 0L : user.getUserId());
|
|
|
+// processInspecion.setNickName(user == null ? "" : user.getNickName());
|
|
|
+ processInspecion.setCarrierId(processInspecion.getLot().getCarrierId());
|
|
|
+ processInspecion.setCarrierCode(processInspecion.getLot().getCarrierCode());
|
|
|
+ processInspecion.setDayworkId(daywork.getId());
|
|
|
+ processInspecion.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
+ processInspecion.setDayworkItemId(dayworkItem.getId());
|
|
|
+ processInspecion.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
|
+ processInspecion.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
+ processInspecion.setIsOutsourcedInspection(1);
|
|
|
+ processInspecion.setProductDescription(processInspecion.getLot().getProductDescription());
|
|
|
+ processInspecion.setLotId(processInspecion.getLot().getId());
|
|
|
+ processInspecion.setLotCode(processInspecion.getLot().getLotCode());
|
|
|
+ processInspecion.setDeptId(daywork.getDeptId());
|
|
|
+ processInspecion.setProductId(processInspecion.getLot().getProductId());
|
|
|
+ processInspecion.setTechnologicalProcessId(processInspecion.getLot().getTechnologicalProcessId());
|
|
|
+ processInspecion.setInspectionCarrierCode(processInspecion.getInspectionCarrierCode());
|
|
|
+ processInspecion.setInspectionCarrierId(processInspecion.getInspectionCarrierId());
|
|
|
+ processInspecion.setOutsourceOrderId(outsourceOrderDetail.getMasterId());
|
|
|
+ processInspecion.setReviewerId(SecurityUtils.getLoginUser().getUserId());
|
|
|
+ processInspecion.setProcessStepNumber(processInspecion.getLot().getProcessStepNumber());
|
|
|
+ processInspecion.setType("outsourcedInspection");
|
|
|
+
|
|
|
+ if (processInspecion.getStartTime() == null) {
|
|
|
+ processInspecion.setStartTime(new Date());
|
|
|
+ }
|
|
|
+ if (processInspecion.getStatus() != 0) {
|
|
|
+ processInspecion.setEndTime(new Date());
|
|
|
+ processInspecion.setFirstUpdaterId(processInspecion.getFirstUpdaterId() == null || processInspecion.getFirstUpdaterId().equals(0L) ? user != null ? user.getUserId() : 0L : processInspecion.getFirstUpdaterId());
|
|
|
+
|
|
|
+ }
|
|
|
+ if (!checkOutsourceDayworkItem(processInspecion.getOutsourceOrderDetailId())) {
|
|
|
+ return error("编辑失败,下序已经生产加工");
|
|
|
+ }
|
|
|
+
|
|
|
+ BizCarrier carrier = bizCarrierService.query().eq("id", processInspecion.getInspectionCarrierId()).one();
|
|
|
+ List<BizDayworkCarrier> dayworkCarriers = bizDayworkCarrierService.query().eq("carrier_id", carrier.getId()).eq("is_changed", 0).list();
|
|
|
+ if (dayworkCarriers.stream().anyMatch(v -> !v.getDayworkId().equals(daywork.getId()))) {
|
|
|
+ return error("检测载具已绑定其他批次");
|
|
|
+ }
|
|
|
+ if (previousItem != null && previousItem.getAuditStatus() == 1) {
|
|
|
+ return error("已通过结算审核,请取消后再进行质检。");
|
|
|
+ }
|
|
|
+ Boolean isSave = false;
|
|
|
+ if(processInspecion.getId() == null) {
|
|
|
+ isSave = true;
|
|
|
+ }
|
|
|
+ //保存
|
|
|
+ if (previousItem != null) {
|
|
|
+ previousItem.setRecheckDate(DateTime.now().toJdkDate());
|
|
|
+ bizProcessInspecionService.updateById(previousItem);
|
|
|
+ }
|
|
|
+ bizProcessInspecionService.saveOrUpdate(processInspecion);
|
|
|
+ //移交仪器室
|
|
|
+ if(processInspecion.getFlag() != null && processInspecion.getFlag()) {
|
|
|
+ BizProcessInspecion inspection = new BizProcessInspecion();
|
|
|
+ inspection.setUserId(processInspecion.getLot().getUserId());
|
|
|
+ inspection.setNickName(processInspecion.getLot().getNickName());
|
|
|
+ inspection.setCarrierId(processInspecion.getCarrierId());
|
|
|
+ inspection.setCarrierCode(processInspecion.getCarrierCode());
|
|
|
+ inspection.setDayworkId(daywork.getId());
|
|
|
+ inspection.setProcessStepNumber(processInspecion.getLot().getProcessStepNumber());
|
|
|
+ inspection.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
+ inspection.setDayworkItemId(dayworkItem.getId());
|
|
|
+ inspection.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
|
+ inspection.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
+ inspection.setProductDescription(processInspecion.getLot().getProductDescription());
|
|
|
+ inspection.setLotId(processInspecion.getLot().getId());
|
|
|
+ inspection.setLotCode(processInspecion.getLot().getLotCode());
|
|
|
+ inspection.setDeptId(daywork.getDeptId());
|
|
|
+ inspection.setProductId(processInspecion.getLot().getProductId());
|
|
|
+ inspection.setTechnologicalProcessId(processInspecion.getLot().getTechnologicalProcessId());
|
|
|
+ inspection.setInspectionCarrierCode(processInspecion.getInspectionCarrierCode());
|
|
|
+ inspection.setInspectionCarrierId(processInspecion.getInspectionCarrierId());
|
|
|
+ inspection.setProcessStepNumber(processInspecion.getProcessStepNumber());
|
|
|
+ inspection.setEquipmentDetailCode(processInspecion.getLot().getEquipmentDetailCode());
|
|
|
+ inspection.setEquipmentDetailId(processInspecion.getLot().getEquipmentDetailId());
|
|
|
+ inspection.setInspectionChamberId(processInspecion.getInspectionChamberId());
|
|
|
+ //inspection.setReviewerId(SecurityUtils.getLoginUser().getUserId());
|
|
|
+ inspection.setProcessStepNumber(processInspecion.getProcessStepNumber());
|
|
|
+ inspection.setFromId(processInspecion.getId());
|
|
|
+ inspection.setType("instrumentRoomInspection");
|
|
|
+ if (inspection.getStartTime() == null) {
|
|
|
+ inspection.setStartTime(new Date());
|
|
|
+ }
|
|
|
+ bizProcessInspecionService.save(inspection);
|
|
|
+// //保存检查明细
|
|
|
+// List<BizInspectionStandardsCheck> inspectionStandardsCheckList = bizInspectionStandardsCheckService.query()
|
|
|
+// .eq("inspection_code", "instrumentRoomInspection")
|
|
|
+// .eq("product_id", inspection.getProductId())
|
|
|
+// .eq("process_id", processInspecion.getLot().getProcessId()).list();
|
|
|
+// List<BizProcessInspectionDetail> detailList = new ArrayList<>();
|
|
|
+// inspectionStandardsCheckList.forEach(inspectionStandardsCheck -> {
|
|
|
+// BizProcessInspectionDetail detail = new BizProcessInspectionDetail();
|
|
|
+// detail.setId(null);
|
|
|
+// detail.setUserId(processInspecion.getLot().getUserId());
|
|
|
+// detail.setProcessInspectionId(inspection.getId());
|
|
|
+// detail.setDayworkId(0L);
|
|
|
+// detail.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
+// detail.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
|
+// detail.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
+// detail.setLotId(processInspecion.getLot().getId());
|
|
|
+// detail.setDayworkItemId(dayworkItem.getId());
|
|
|
+// detail.setCheckStandard(inspectionStandardsCheck.getStandard());
|
|
|
+// detail.setInspectionStandardsId(inspectionStandardsCheck.getId());
|
|
|
+// detailList.add(detail);
|
|
|
+// });
|
|
|
+// if(!detailList.isEmpty()) {
|
|
|
+// processInspectionDetailService.saveBatch(detailList);
|
|
|
+// }
|
|
|
+ //绑定检测载具
|
|
|
+ BizDayworkCarrier newDayworkCarrier = new BizDayworkCarrier();
|
|
|
+ newDayworkCarrier.setDayworkId(inspection.getDayworkId());
|
|
|
+ newDayworkCarrier.setCarrierCode(inspection.getInspectionCarrierCode());
|
|
|
+ newDayworkCarrier.setCarrierId(inspection.getInspectionCarrierId());
|
|
|
+ newDayworkCarrier.setLotCode(inspection.getLotCode());
|
|
|
+ newDayworkCarrier.setLotId(inspection.getLotId());
|
|
|
+ newDayworkCarrier.setProductionPlanDetailId(inspection.getProductionPlanDetailId());
|
|
|
+ newDayworkCarrier.setProcessInspectionId(inspection.getId());
|
|
|
+ bizDayworkCarrierService.save(newDayworkCarrier);
|
|
|
+ }
|
|
|
+ if(isSave) {
|
|
|
+ if (dayworkCarriers.stream().noneMatch(v -> v.getDayworkId().equals(daywork.getId())) && (processInspecion.getIsInspectionCarrierChanged() == null || processInspecion.getIsInspectionCarrierChanged().equals(0))) {
|
|
|
+ // 该检测载具需要绑定到当前批次
|
|
|
+ BizDayworkCarrier newDayworkCarrier = new BizDayworkCarrier();
|
|
|
+ newDayworkCarrier.setDayworkId(processInspecion.getDayworkId());
|
|
|
+ newDayworkCarrier.setCarrierCode(carrier.getCode());
|
|
|
+ newDayworkCarrier.setCarrierId(carrier.getId());
|
|
|
+ newDayworkCarrier.setLotCode(processInspecion.getLotCode());
|
|
|
+ newDayworkCarrier.setLotId(processInspecion.getLotId());
|
|
|
+ newDayworkCarrier.setProductionPlanDetailId(processInspecion.getProductionPlanDetailId());
|
|
|
+ newDayworkCarrier.setProcessInspectionId(processInspecion.getId());
|
|
|
+ bizDayworkCarrierService.save(newDayworkCarrier);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<BizDayworkItemConsult> consults = new ArrayList<>();
|
|
|
+ if (processInspecion.getId() != null) {
|
|
|
+ //保存废品信息
|
|
|
+ List<BizProcessInspectionDetail> rejects = processInspecion.getRejects();
|
|
|
+ //保存前先删除原先废品信息
|
|
|
+ BizDayworkItemReject rej = new BizDayworkItemReject();
|
|
|
+ rej.setProcessInspectionId(processInspecion.getId());
|
|
|
+ bizDayworkItemRejectService.removeReject(rej);
|
|
|
+ BizProcessInspectionDetail inspectionDetail = new BizProcessInspectionDetail();
|
|
|
+ inspectionDetail.setProcessInspectionId(processInspecion.getId());
|
|
|
+ processInspectionDetailService.physicalDelete(inspectionDetail);
|
|
|
+ BizDayworkItemReject newRej = new BizDayworkItemReject();
|
|
|
+ newRej.setRejectNum(0L);
|
|
|
+
|
|
|
+ if (rejects != null && rejects.size() > 0) {
|
|
|
+ for (BizProcessInspectionDetail reject : rejects) {
|
|
|
+ reject.setId(null);
|
|
|
+ reject.setUserId(user == null ? 0L : user.getUserId());
|
|
|
+ reject.setProcessInspectionId(processInspecion.getId());
|
|
|
+ reject.setDayworkId(0L);
|
|
|
+ reject.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
+ reject.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
|
+ reject.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
+ reject.setLotId(processInspecion.getLot().getId());
|
|
|
+ reject.setDayworkItemId(dayworkItem.getId());
|
|
|
+ Long rejectNum = reject.getRejectNum() == null ? 0L : reject.getRejectNum();
|
|
|
+ newRej.setRejectNum(rejectNum);
|
|
|
+ newRej.setUserId(user == null ? 0L : user.getUserId());
|
|
|
+ newRej.setProcessInspectionId(processInspecion.getId());
|
|
|
+ newRej.setDayworkId(0L);
|
|
|
+ newRej.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
+ newRej.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
|
+ newRej.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
+ newRej.setLotId(processInspecion.getLot().getId());
|
|
|
+ newRej.setDayworkItemId(dayworkItem.getId());
|
|
|
+ newRej.setReason("外协检查废品");
|
|
|
+ newRej.setDeptId(processInspecion.getDeptId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ processInspectionDetailService.saveBatch(rejects);
|
|
|
+ bizDayworkItemRejectService.save(newRej);
|
|
|
+ //保存咨询信息
|
|
|
+ consults.addAll(processInspecion.getDayworkItemConsults() == null ? new ArrayList<>() : processInspecion.getDayworkItemConsults());
|
|
|
+ if (consults.size() > 0) {
|
|
|
+ for (BizDayworkItemConsult consult : consults) {
|
|
|
+ consult.setUserId(user == null ? 0L : user.getUserId());
|
|
|
+ consult.setNickName(user == null ? "" : user.getNickName());
|
|
|
+ consult.setDayworkId(daywork.getId());
|
|
|
+ consult.setProcessInspectionId(processInspecion.getId());
|
|
|
+ consult.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
+ consult.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
|
+ consult.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
+ consult.setLotId(processInspecion.getLot().getId());
|
|
|
+ consult.setLotCode(processInspecion.getLot().getLotCode());
|
|
|
+ consult.setDayworkId(daywork.getId());
|
|
|
+ consult.setDayworkItemId(dayworkItem.getId());
|
|
|
+ consult.setProductId(processInspecion.getLot().getProductId());
|
|
|
+ consult.setProductDescription(processInspecion.getLot().getProductDescription());
|
|
|
+ consult.setTechnologicalProcessId(processInspecion.getLot().getTechnologicalProcessId());
|
|
|
+ consult.setTechnologicalProcessDetailId(dayworkItem.getTechnologicalProcessDetailId());
|
|
|
+ consult.setProcessId(dayworkItem.getProcessId());
|
|
|
+ consult.setProcessAlias(processInspecion.getLot().getProcessAlias());
|
|
|
+ consult.setIsOutsourcedInspection(1);
|
|
|
+ consult.setTechnicianId(technicianUser == null ? 0L : technicianUser.getUserId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //修改daywaork信息
|
|
|
+ dayworkItem.setIsProcessInspection(1);
|
|
|
+ return success(bizDayworkItemService.saveOrUpdate(dayworkItem) && (consults.isEmpty() || bizDayworkItemConsultService.saveOrUpdateBatch(consults)));
|
|
|
+ }
|
|
|
|
|
|
|
|
|
@Transactional
|
|
@@ -1285,23 +1542,231 @@ public TableDataInfo examineList(@RequestBody BizProcessInspecion bizProcessInsp
|
|
|
dayworkItem.setIsProcessInspection(1);
|
|
|
return success(bizDayworkItemService.saveOrUpdate(dayworkItem));
|
|
|
}
|
|
|
- //查找该检查是否已经移交给了仪器室
|
|
|
- @PostMapping("/getInstrumentRoomInspection")
|
|
|
- public AjaxResult getInstrumentRoomInspection(@RequestBody BizProcessInspecion bizProcessInspecion) throws NoSuchFieldException, IllegalAccessException {
|
|
|
- List<BizProcessInspecion> list = bizProcessInspecionService.query().eq("from_id", bizProcessInspecion.getId()).eq("type", "instrumentRoomInspection").list();
|
|
|
- return success(list);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-// /**
|
|
|
-// * 根据箱号查询是否为一箱多批
|
|
|
-// */
|
|
|
- //原代码备份
|
|
|
-// @PostMapping("/getCarrierInfo")
|
|
|
-// public AjaxResult getCarrierInfo(@RequestBody BizDayworkCarrier dayworkCarrier) throws NoSuchFieldException, IllegalAccessException {
|
|
|
-// List<BizDayworkCarrier> list = bizDayworkCarrierService.getList(dayworkCarrier);
|
|
|
-// if (list.size() == 0) {
|
|
|
-// throw new RuntimeException("该箱号未绑定任何批次");
|
|
|
+ @Transactional
|
|
|
+ @PostMapping("/saveFirstInspection")
|
|
|
+ public AjaxResult saveFirstInspection(@RequestBody BizProcessInspecion processInspecion) throws NoSuchFieldException, IllegalAccessException {
|
|
|
+ //根据lot信息保存序检表
|
|
|
+ BizDaywork daywork = bizDayworkService.query().eq("lot_code", processInspecion.getLot().getLotCode()).one();
|
|
|
+ BizProduct product = bizProductService.getById(processInspecion.getLot().getProductId());
|
|
|
+ SysUser technicianUser = sysUserService.selectUserById(product.getTechnicianId());
|
|
|
+ BizDayworkItem dayworkItem = bizDayworkItemService.getById(processInspecion.getLot().getDayworkItemId());
|
|
|
+ processInspecion.setUserId(processInspecion.getLot().getUserId());
|
|
|
+ processInspecion.setNickName(processInspecion.getLot().getNickName());
|
|
|
+ processInspecion.setCarrierId(processInspecion.getLot().getCarrierId());
|
|
|
+ processInspecion.setCarrierCode(processInspecion.getLot().getCarrierCode());
|
|
|
+ processInspecion.setDayworkId(daywork.getId());
|
|
|
+ processInspecion.setProcessStepNumber(processInspecion.getLot().getProcessStepNumber());
|
|
|
+ processInspecion.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
+ processInspecion.setDayworkItemId(dayworkItem.getId());
|
|
|
+ processInspecion.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
|
+ processInspecion.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
+ processInspecion.setProductDescription(processInspecion.getLot().getProductDescription());
|
|
|
+ processInspecion.setLotId(processInspecion.getLot().getId());
|
|
|
+ processInspecion.setLotCode(processInspecion.getLot().getLotCode());
|
|
|
+ processInspecion.setDeptId(daywork.getDeptId());
|
|
|
+ processInspecion.setProductId(processInspecion.getLot().getProductId());
|
|
|
+ processInspecion.setTechnologicalProcessId(processInspecion.getLot().getTechnologicalProcessId());
|
|
|
+ processInspecion.setInspectionCarrierCode(processInspecion.getInspectionCarrierCode());
|
|
|
+ processInspecion.setInspectionCarrierId(processInspecion.getInspectionCarrierId());
|
|
|
+ processInspecion.setEquipmentDetailCode(processInspecion.getLot().getEquipmentDetailCode());
|
|
|
+ processInspecion.setEquipmentDetailId(processInspecion.getLot().getEquipmentDetailId());
|
|
|
+ if(processInspecion.getId() !=null) {
|
|
|
+ processInspecion.setReviewerId(SecurityUtils.getLoginUser().getUserId());
|
|
|
+ }
|
|
|
+ processInspecion.setType("firstArticleInspection");
|
|
|
+ if (processInspecion.getStartTime() == null) {
|
|
|
+ processInspecion.setStartTime(new Date());
|
|
|
+ }
|
|
|
+ if (processInspecion.getStatus() != 0) {
|
|
|
+ processInspecion.setEndTime(new Date());
|
|
|
+ processInspecion.setFirstUpdaterId(processInspecion.getFirstUpdaterId() == null || processInspecion.getFirstUpdaterId().equals(0L) ? SecurityUtils.getLoginUser().getUserId() : processInspecion.getFirstUpdaterId());
|
|
|
+ }
|
|
|
+ if (!checkDayworkItem(processInspecion.getLot().getDayworkItemId())) {
|
|
|
+ return error("编辑失败,下序已经生产加工");
|
|
|
+ }
|
|
|
+
|
|
|
+ //BizCarrier carrier = bizCarrierService.query().eq("id", processInspecion.getInspectionCarrierId()).one();
|
|
|
+ List<BizDayworkCarrier> dayworkCarriers = bizDayworkCarrierService.query().eq("carrier_id", processInspecion.getInspectionCarrierId()).eq("is_changed", 0).list();
|
|
|
+ if (dayworkCarriers.stream().anyMatch(v -> !v.getDayworkId().equals(processInspecion.getDayworkId()))) {
|
|
|
+ return error("检测载具已绑定其他批次");
|
|
|
+ }
|
|
|
+ Boolean isSave = false;
|
|
|
+ if(processInspecion.getId() == null) {
|
|
|
+ isSave = true;
|
|
|
+ }
|
|
|
+ //保存
|
|
|
+ bizProcessInspecionService.saveOrUpdate(processInspecion);
|
|
|
+ if(isSave) {
|
|
|
+ if (dayworkCarriers.stream().noneMatch(v -> v.getDayworkId().equals(processInspecion.getDayworkId())) && (processInspecion.getIsInspectionCarrierChanged() == null || processInspecion.getIsInspectionCarrierChanged().equals(0))) {
|
|
|
+ // 该检测载具需要绑定到当前批次
|
|
|
+ BizDayworkCarrier newDayworkCarrier = new BizDayworkCarrier();
|
|
|
+ newDayworkCarrier.setDayworkId(processInspecion.getDayworkId());
|
|
|
+ newDayworkCarrier.setCarrierCode(processInspecion.getInspectionCarrierCode());
|
|
|
+ newDayworkCarrier.setCarrierId(processInspecion.getInspectionCarrierId());
|
|
|
+ newDayworkCarrier.setLotCode(processInspecion.getLotCode());
|
|
|
+ newDayworkCarrier.setLotId(processInspecion.getLotId());
|
|
|
+ newDayworkCarrier.setProductionPlanDetailId(processInspecion.getProductionPlanDetailId());
|
|
|
+ newDayworkCarrier.setProcessInspectionId(processInspecion.getId());
|
|
|
+ bizDayworkCarrierService.save(newDayworkCarrier);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //移交仪器室
|
|
|
+ if(processInspecion.getFlag() != null && processInspecion.getFlag()) {
|
|
|
+ BizProcessInspecion inspection = new BizProcessInspecion();
|
|
|
+ inspection.setUserId(processInspecion.getLot().getUserId());
|
|
|
+ inspection.setNickName(processInspecion.getLot().getNickName());
|
|
|
+ inspection.setCarrierId(processInspecion.getCarrierId());
|
|
|
+ inspection.setCarrierCode(processInspecion.getCarrierCode());
|
|
|
+ inspection.setDayworkId(daywork.getId());
|
|
|
+ inspection.setProcessStepNumber(processInspecion.getLot().getProcessStepNumber());
|
|
|
+ inspection.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
+ inspection.setDayworkItemId(dayworkItem.getId());
|
|
|
+ inspection.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
|
+ inspection.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
+ inspection.setProductDescription(processInspecion.getLot().getProductDescription());
|
|
|
+ inspection.setLotId(processInspecion.getLot().getId());
|
|
|
+ inspection.setLotCode(processInspecion.getLot().getLotCode());
|
|
|
+ inspection.setDeptId(daywork.getDeptId());
|
|
|
+ inspection.setProductId(processInspecion.getLot().getProductId());
|
|
|
+ inspection.setTechnologicalProcessId(processInspecion.getLot().getTechnologicalProcessId());
|
|
|
+ inspection.setInspectionCarrierCode(processInspecion.getInspectionCarrierCode());
|
|
|
+ inspection.setInspectionCarrierId(processInspecion.getInspectionCarrierId());
|
|
|
+ inspection.setProcessStepNumber(processInspecion.getProcessStepNumber());
|
|
|
+ inspection.setEquipmentDetailCode(processInspecion.getLot().getEquipmentDetailCode());
|
|
|
+ inspection.setEquipmentDetailId(processInspecion.getLot().getEquipmentDetailId());
|
|
|
+ inspection.setInspectionChamberId(processInspecion.getInspectionChamberId());
|
|
|
+ //inspection.setReviewerId(SecurityUtils.getLoginUser().getUserId());
|
|
|
+ inspection.setProcessStepNumber(processInspecion.getProcessStepNumber());
|
|
|
+ inspection.setFromId(processInspecion.getId());
|
|
|
+ inspection.setType("instrumentRoomInspection");
|
|
|
+ if (inspection.getStartTime() == null) {
|
|
|
+ inspection.setStartTime(new Date());
|
|
|
+ }
|
|
|
+ bizProcessInspecionService.save(inspection);
|
|
|
+ //保存检查明细
|
|
|
+// List<BizInspectionStandardsCheck> inspectionStandardsCheckList = bizInspectionStandardsCheckService.query()
|
|
|
+// .eq("inspection_code", "instrumentRoomInspection")
|
|
|
+// .eq("product_id", inspection.getProductId())
|
|
|
+// .eq("process_id", processInspecion.getLot().getProcessId()).list();
|
|
|
+// List<BizProcessInspectionDetail> detailList = new ArrayList<>();
|
|
|
+// inspectionStandardsCheckList.forEach(inspectionStandardsCheck -> {
|
|
|
+// BizProcessInspectionDetail detail = new BizProcessInspectionDetail();
|
|
|
+// detail.setId(null);
|
|
|
+// detail.setUserId(processInspecion.getLot().getUserId());
|
|
|
+// detail.setProcessInspectionId(inspection.getId());
|
|
|
+// detail.setDayworkId(0L);
|
|
|
+// detail.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
+// detail.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
|
+// detail.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
+// detail.setLotId(processInspecion.getLot().getId());
|
|
|
+// detail.setDayworkItemId(dayworkItem.getId());
|
|
|
+// detail.setCheckStandard(inspectionStandardsCheck.getStandard());
|
|
|
+// detail.setInspectionStandardsId(inspectionStandardsCheck.getId());
|
|
|
+// detailList.add(detail);
|
|
|
+// });
|
|
|
+// if(!detailList.isEmpty()) {
|
|
|
+// processInspectionDetailService.saveBatch(detailList);
|
|
|
+// }
|
|
|
+ //绑定检测载具
|
|
|
+ BizDayworkCarrier newDayworkCarrier = new BizDayworkCarrier();
|
|
|
+ newDayworkCarrier.setDayworkId(inspection.getDayworkId());
|
|
|
+ newDayworkCarrier.setCarrierCode(inspection.getInspectionCarrierCode());
|
|
|
+ newDayworkCarrier.setCarrierId(inspection.getInspectionCarrierId());
|
|
|
+ newDayworkCarrier.setLotCode(inspection.getLotCode());
|
|
|
+ newDayworkCarrier.setLotId(inspection.getLotId());
|
|
|
+ newDayworkCarrier.setProductionPlanDetailId(inspection.getProductionPlanDetailId());
|
|
|
+ newDayworkCarrier.setProcessInspectionId(inspection.getId());
|
|
|
+ bizDayworkCarrierService.save(newDayworkCarrier);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //保存废品信息
|
|
|
+ List<BizProcessInspectionDetail> rejects = processInspecion.getProcessInspectionDetails();
|
|
|
+ //保存前先删除原先废品信息
|
|
|
+ List<BizProcessInspectionDetail> processInspectionDetailList = processInspectionDetailService.query().eq("process_inspection_id", processInspecion.getId()).list();
|
|
|
+ processInspectionDetailService.removeBatchByIds(processInspectionDetailList);
|
|
|
+
|
|
|
+ if (rejects != null && rejects.size() > 0) {
|
|
|
+ for (BizProcessInspectionDetail reject : rejects) {
|
|
|
+ reject.setId(null);
|
|
|
+ reject.setUserId(processInspecion.getLot().getUserId());
|
|
|
+ reject.setProcessInspectionId(processInspecion.getId());
|
|
|
+ reject.setDayworkId(0L);
|
|
|
+ reject.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
+ reject.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
|
+ reject.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
+ reject.setLotId(processInspecion.getLot().getId());
|
|
|
+ reject.setDayworkItemId(dayworkItem.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ processInspectionDetailService.saveBatch(rejects);
|
|
|
+ //保存咨询信息
|
|
|
+
|
|
|
+ List<BizDayworkItemConsult> consults = processInspecion.getDayworkItemConsults().stream().filter(item-> item.getId()==null).collect(Collectors.toList());
|
|
|
+ List<BizDayworkItemConsult> needAdd = new ArrayList<>();
|
|
|
+ if (consults != null && consults.size() > 0) {
|
|
|
+ for (BizDayworkItemConsult consult : consults) {
|
|
|
+ BizDayworkItemConsult consultInfo = new BizDayworkItemConsult();
|
|
|
+ consultInfo.setPictures(consult.getPictures());
|
|
|
+ consultInfo.setUserId(SecurityUtils.getLoginUser().getUserId());
|
|
|
+ consultInfo.setNickName(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
+ consultInfo.setDayworkId(daywork.getId());
|
|
|
+ consultInfo.setContent(consult.getContent());
|
|
|
+ consultInfo.setConsultDepartment(consult.getConsultDepartment());
|
|
|
+ consultInfo.setProcessInspectionId(processInspecion.getId());
|
|
|
+ consultInfo.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
+ consultInfo.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
|
+ consultInfo.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
+ consultInfo.setLotId(processInspecion.getLot().getId());
|
|
|
+ consultInfo.setLotCode(processInspecion.getLot().getLotCode());
|
|
|
+ consultInfo.setDayworkId(daywork.getId());
|
|
|
+ consultInfo.setDayworkItemId(dayworkItem.getId());
|
|
|
+ consultInfo.setProductId(processInspecion.getLot().getProductId());
|
|
|
+ consultInfo.setProductDescription(processInspecion.getLot().getProductDescription());
|
|
|
+ consultInfo.setTechnologicalProcessId(processInspecion.getLot().getTechnologicalProcessId());
|
|
|
+ consultInfo.setTechnologicalProcessDetailId(dayworkItem.getTechnologicalProcessDetailId());
|
|
|
+ consultInfo.setProcessId(dayworkItem.getProcessId());
|
|
|
+ consultInfo.setIsProcessInspection(1);
|
|
|
+ consultInfo.setProcessAlias(processInspecion.getLot().getProcessAlias());
|
|
|
+ consultInfo.setTechnicianId(technicianUser == null ? 0L : technicianUser.getUserId());
|
|
|
+ needAdd.add(consultInfo);
|
|
|
+ }
|
|
|
+ bizDayworkItemConsultService.saveBatch(needAdd);
|
|
|
+ List<BizDayworkItemConsultPicture> pictures = new ArrayList<>();
|
|
|
+ needAdd.forEach(ne ->{
|
|
|
+ ne.getPictures().forEach(info ->{
|
|
|
+ BizDayworkItemConsultPicture consultPicture = new BizDayworkItemConsultPicture();
|
|
|
+ consultPicture.setDayworkItemConsultId(ne.getId());
|
|
|
+ consultPicture.setPictureName(info.getPictureName());
|
|
|
+ consultPicture.setUrl(info.getUrl());
|
|
|
+ pictures.add(consultPicture);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ bizDayworkItemConsultPictureService.saveBatch(pictures);
|
|
|
+ }
|
|
|
+
|
|
|
+ //修改daywaork信息
|
|
|
+ dayworkItem.setIsProcessInspection(1);
|
|
|
+ return success(bizDayworkItemService.saveOrUpdate(dayworkItem));
|
|
|
+ }
|
|
|
+ //查找该检查是否已经移交给了仪器室
|
|
|
+ @PostMapping("/getInstrumentRoomInspection")
|
|
|
+ public AjaxResult getInstrumentRoomInspection(@RequestBody BizProcessInspecion bizProcessInspecion) throws NoSuchFieldException, IllegalAccessException {
|
|
|
+ List<BizProcessInspecion> list = bizProcessInspecionService.query().eq("from_id", bizProcessInspecion.getId()).eq("type", "instrumentRoomInspection").list();
|
|
|
+ return success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 根据箱号查询是否为一箱多批
|
|
|
+// */
|
|
|
+ //原代码备份
|
|
|
+// @PostMapping("/getCarrierInfo")
|
|
|
+// public AjaxResult getCarrierInfo(@RequestBody BizDayworkCarrier dayworkCarrier) throws NoSuchFieldException, IllegalAccessException {
|
|
|
+// List<BizDayworkCarrier> list = bizDayworkCarrierService.getList(dayworkCarrier);
|
|
|
+// if (list.size() == 0) {
|
|
|
+// throw new RuntimeException("该箱号未绑定任何批次");
|
|
|
// }
|
|
|
//
|
|
|
// return success(list);
|
|
@@ -1620,29 +2085,26 @@ public TableDataInfo examineList(@RequestBody BizProcessInspecion bizProcessInsp
|
|
|
if (!checkDayworkItem(processInspecion.getLot().getDayworkItemId())) {
|
|
|
return error("编辑失败,下序已经生产加工");
|
|
|
}
|
|
|
-
|
|
|
- //BizCarrier carrier = bizCarrierService.query().eq("id", processInspecion.getInspectionCarrierId()).one();
|
|
|
+// BizCarrier carrier = bizCarrierService.query().eq("id", processInspecion.getInspectionCarrierId()).one();
|
|
|
// List<BizDayworkCarrier> dayworkCarriers = bizDayworkCarrierService.query().eq("carrier_id", processInspecion.getInspectionCarrierId()).eq("is_changed", 0).list();
|
|
|
// if (dayworkCarriers.stream().anyMatch(v -> !v.getDayworkId().equals(processInspecion.getDayworkId()))) {
|
|
|
// return error("检测载具已绑定其他批次");
|
|
|
// }
|
|
|
-
|
|
|
//保存
|
|
|
bizProcessInspecionService.saveOrUpdate(processInspecion);
|
|
|
|
|
|
-// if (dayworkCarriers.stream().noneMatch(v -> v.getDayworkId().equals(processInspecion.getDayworkId())) && (processInspecion.getIsInspectionCarrierChanged() == null || processInspecion.getIsInspectionCarrierChanged().equals(0))) {
|
|
|
-// // 该检测载具需要绑定到当前批次
|
|
|
-// BizDayworkCarrier newDayworkCarrier = new BizDayworkCarrier();
|
|
|
-// newDayworkCarrier.setDayworkId(processInspecion.getDayworkId());
|
|
|
-// newDayworkCarrier.setCarrierCode(processInspecion.getInspectionCarrierCode());
|
|
|
-// newDayworkCarrier.setCarrierId(processInspecion.getInspectionCarrierId());
|
|
|
-// newDayworkCarrier.setLotCode(processInspecion.getLotCode());
|
|
|
-// newDayworkCarrier.setLotId(processInspecion.getLotId());
|
|
|
-// newDayworkCarrier.setProductionPlanDetailId(processInspecion.getProductionPlanDetailId());
|
|
|
-// newDayworkCarrier.setProcessInspectionId(processInspecion.getId());
|
|
|
-// bizDayworkCarrierService.save(newDayworkCarrier);
|
|
|
-// }
|
|
|
-
|
|
|
+// if (dayworkCarriers.stream().noneMatch(v -> v.getDayworkId().equals(processInspecion.getDayworkId())) && (processInspecion.getIsInspectionCarrierChanged() == null || processInspecion.getIsInspectionCarrierChanged().equals(0))) {
|
|
|
+// // 该检测载具需要绑定到当前批次
|
|
|
+// BizDayworkCarrier newDayworkCarrier = new BizDayworkCarrier();
|
|
|
+// newDayworkCarrier.setDayworkId(processInspecion.getDayworkId());
|
|
|
+// newDayworkCarrier.setCarrierCode(processInspecion.getInspectionCarrierCode());
|
|
|
+// newDayworkCarrier.setCarrierId(processInspecion.getInspectionCarrierId());
|
|
|
+// newDayworkCarrier.setLotCode(processInspecion.getLotCode());
|
|
|
+// newDayworkCarrier.setLotId(processInspecion.getLotId());
|
|
|
+// newDayworkCarrier.setProductionPlanDetailId(processInspecion.getProductionPlanDetailId());
|
|
|
+// newDayworkCarrier.setProcessInspectionId(processInspecion.getId());
|
|
|
+// bizDayworkCarrierService.save(newDayworkCarrier);
|
|
|
+// }
|
|
|
//保存废品信息
|
|
|
List<BizProcessInspectionDetail> rejects = processInspecion.getProcessInspectionDetails();
|
|
|
//保存前先删除原先废品信息
|
|
@@ -1712,6 +2174,109 @@ public TableDataInfo examineList(@RequestBody BizProcessInspecion bizProcessInsp
|
|
|
dayworkItem.setIsProcessInspection(1);
|
|
|
return success(bizDayworkItemService.saveOrUpdate(dayworkItem));
|
|
|
}
|
|
|
+ //该方法只在首件送检时选择仪器室时使用
|
|
|
+ @Transactional
|
|
|
+ @PostMapping("/saveFirstInstrumentRoomInspection")
|
|
|
+ public AjaxResult saveFirstInstrumentRoomInspection(@RequestBody BizProcessInspecion processInspecion) throws NoSuchFieldException, IllegalAccessException {
|
|
|
+ //根据lot信息保存序检表
|
|
|
+ BizDaywork daywork = bizDayworkService.query().eq("lot_code", processInspecion.getLot().getLotCode()).one();
|
|
|
+ BizProduct product = bizProductService.getById(processInspecion.getLot().getProductId());
|
|
|
+ SysUser technicianUser = sysUserService.selectUserById(product.getTechnicianId());
|
|
|
+ BizDayworkItem dayworkItem = bizDayworkItemService.getById(processInspecion.getLot().getDayworkItemId());
|
|
|
+ processInspecion.setUserId(processInspecion.getLot().getUserId());
|
|
|
+ processInspecion.setNickName(processInspecion.getLot().getNickName());
|
|
|
+ processInspecion.setCarrierId(processInspecion.getLot().getCarrierId());
|
|
|
+ processInspecion.setCarrierCode(processInspecion.getLot().getCarrierCode());
|
|
|
+ processInspecion.setDayworkId(daywork.getId());
|
|
|
+ processInspecion.setProcessStepNumber(processInspecion.getLot().getProcessStepNumber());
|
|
|
+ processInspecion.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
+ processInspecion.setDayworkItemId(dayworkItem.getId());
|
|
|
+ processInspecion.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
|
+ processInspecion.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
+ processInspecion.setProductDescription(processInspecion.getLot().getProductDescription());
|
|
|
+ processInspecion.setLotId(processInspecion.getLot().getId());
|
|
|
+ processInspecion.setLotCode(processInspecion.getLot().getLotCode());
|
|
|
+ processInspecion.setDeptId(daywork.getDeptId());
|
|
|
+ processInspecion.setProductId(processInspecion.getLot().getProductId());
|
|
|
+ processInspecion.setTechnologicalProcessId(processInspecion.getLot().getTechnologicalProcessId());
|
|
|
+ processInspecion.setInspectionCarrierCode(processInspecion.getInspectionCarrierCode());
|
|
|
+ processInspecion.setInspectionCarrierId(processInspecion.getInspectionCarrierId());
|
|
|
+ processInspecion.setEquipmentDetailCode(processInspecion.getLot().getEquipmentDetailCode());
|
|
|
+ processInspecion.setEquipmentDetailId(processInspecion.getLot().getEquipmentDetailId());
|
|
|
+ processInspecion.setType("instrumentRoomInspection");
|
|
|
+ if (processInspecion.getStartTime() == null) {
|
|
|
+ processInspecion.setStartTime(new Date());
|
|
|
+ }
|
|
|
+ if (processInspecion.getStatus() != 0) {
|
|
|
+ processInspecion.setEndTime(new Date());
|
|
|
+ processInspecion.setFirstUpdaterId(processInspecion.getFirstUpdaterId() == null || processInspecion.getFirstUpdaterId().equals(0L) ? SecurityUtils.getLoginUser().getUserId() : processInspecion.getFirstUpdaterId());
|
|
|
+ }
|
|
|
+ if (!checkDayworkItem(processInspecion.getLot().getDayworkItemId())) {
|
|
|
+ return error("编辑失败,下序已经生产加工");
|
|
|
+ }
|
|
|
+ BizCarrier carrier = bizCarrierService.query().eq("id", processInspecion.getInspectionCarrierId()).one();
|
|
|
+ List<BizDayworkCarrier> dayworkCarriers = bizDayworkCarrierService.query().eq("carrier_id", processInspecion.getInspectionCarrierId()).eq("is_changed", 0).list();
|
|
|
+ if (dayworkCarriers.stream().anyMatch(v -> !v.getDayworkId().equals(processInspecion.getDayworkId()))) {
|
|
|
+ return error("检测载具已绑定其他批次");
|
|
|
+ }
|
|
|
+ //保存
|
|
|
+ bizProcessInspecionService.saveOrUpdate(processInspecion);
|
|
|
+
|
|
|
+ if (dayworkCarriers.stream().noneMatch(v -> v.getDayworkId().equals(processInspecion.getDayworkId())) && (processInspecion.getIsInspectionCarrierChanged() == null || processInspecion.getIsInspectionCarrierChanged().equals(0))) {
|
|
|
+ // 该检测载具需要绑定到当前批次
|
|
|
+ BizDayworkCarrier newDayworkCarrier = new BizDayworkCarrier();
|
|
|
+ newDayworkCarrier.setDayworkId(processInspecion.getDayworkId());
|
|
|
+ newDayworkCarrier.setCarrierCode(processInspecion.getInspectionCarrierCode());
|
|
|
+ newDayworkCarrier.setCarrierId(processInspecion.getInspectionCarrierId());
|
|
|
+ newDayworkCarrier.setLotCode(processInspecion.getLotCode());
|
|
|
+ newDayworkCarrier.setLotId(processInspecion.getLotId());
|
|
|
+ newDayworkCarrier.setProductionPlanDetailId(processInspecion.getProductionPlanDetailId());
|
|
|
+ newDayworkCarrier.setProcessInspectionId(processInspecion.getId());
|
|
|
+ bizDayworkCarrierService.save(newDayworkCarrier);
|
|
|
+ }
|
|
|
+ //保存废品信息
|
|
|
+ List<BizProcessInspectionDetail> rejects = processInspecion.getProcessInspectionDetails();
|
|
|
+ if (rejects != null && rejects.size() > 0) {
|
|
|
+ for (BizProcessInspectionDetail reject : rejects) {
|
|
|
+ reject.setId(null);
|
|
|
+ reject.setUserId(processInspecion.getLot().getUserId());
|
|
|
+ reject.setProcessInspectionId(processInspecion.getId());
|
|
|
+ reject.setDayworkId(0L);
|
|
|
+ reject.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
+ reject.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
|
+ reject.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
+ reject.setLotId(processInspecion.getLot().getId());
|
|
|
+ reject.setDayworkItemId(dayworkItem.getId());
|
|
|
+ }
|
|
|
+ processInspectionDetailService.saveBatch(rejects);
|
|
|
+ }else{
|
|
|
+ //如果没选择检查标准,则自动带入所有的检查
|
|
|
+ List<BizInspectionStandardsCheck> inspectionStandardsCheckList = bizInspectionStandardsCheckService.query()
|
|
|
+ .eq("inspection_code", "instrumentRoomInspection")
|
|
|
+ .eq("product_id", processInspecion.getProductId())
|
|
|
+ .eq("process_id", processInspecion.getLot().getProcessId()).list();
|
|
|
+ List<BizProcessInspectionDetail> detailList = new ArrayList<>();
|
|
|
+ inspectionStandardsCheckList.forEach(inspectionStandardsCheck -> {
|
|
|
+ BizProcessInspectionDetail detail = new BizProcessInspectionDetail();
|
|
|
+ detail.setId(null);
|
|
|
+ detail.setUserId(processInspecion.getLot().getUserId());
|
|
|
+ detail.setProcessInspectionId(processInspecion.getId());
|
|
|
+ detail.setDayworkId(0L);
|
|
|
+ detail.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
+ detail.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
|
+ detail.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
+ detail.setLotId(processInspecion.getLot().getId());
|
|
|
+ detail.setDayworkItemId(dayworkItem.getId());
|
|
|
+ detail.setCheckStandard(inspectionStandardsCheck.getStandard());
|
|
|
+ detail.setInspectionStandardsId(inspectionStandardsCheck.getId());
|
|
|
+ detailList.add(detail);
|
|
|
+ });
|
|
|
+ processInspectionDetailService.saveBatch(detailList);
|
|
|
+ }
|
|
|
+ //修改daywaork信息
|
|
|
+ dayworkItem.setIsProcessInspection(1);
|
|
|
+ return success(bizDayworkItemService.saveOrUpdate(dayworkItem));
|
|
|
+ }
|
|
|
//出厂检
|
|
|
@Transactional
|
|
|
@PostMapping("/saveFactoryInspection")
|
|
@@ -1768,8 +2333,8 @@ public TableDataInfo examineList(@RequestBody BizProcessInspecion bizProcessInsp
|
|
|
if(processInspecion.getId() == null) {
|
|
|
isSave = true;
|
|
|
}
|
|
|
- //载具保存
|
|
|
bizProcessInspecionService.saveOrUpdate(processInspecion);
|
|
|
+ //载具保存
|
|
|
if(isSave) {
|
|
|
if (dayworkCarriers.stream().noneMatch(v -> v.getDayworkId().equals(processInspecion.getDayworkId())) && (processInspecion.getIsInspectionCarrierChanged() == null || processInspecion.getIsInspectionCarrierChanged().equals(0))) {
|
|
|
// 该检测载具需要绑定到当前批次
|
|
@@ -1784,33 +2349,6 @@ public TableDataInfo examineList(@RequestBody BizProcessInspecion bizProcessInsp
|
|
|
bizDayworkCarrierService.save(newDayworkCarrier);
|
|
|
}
|
|
|
}
|
|
|
- //检查详情,咨询保存
|
|
|
- if(isSave) {
|
|
|
- //保存检查明细
|
|
|
- List<BizInspectionStandardsCheck> inspectionStandardsCheckList = bizInspectionStandardsCheckService.query()
|
|
|
- .eq("inspection_code", "factoryInspection")
|
|
|
- .eq("product_id", processInspecion.getProductId())
|
|
|
- .eq("process_id", processInspecion.getLot().getProcessId()).list();
|
|
|
- List<BizProcessInspectionDetail> detailList = new ArrayList<>();
|
|
|
- inspectionStandardsCheckList.forEach(inspectionStandardsCheck -> {
|
|
|
- BizProcessInspectionDetail detail = new BizProcessInspectionDetail();
|
|
|
- detail.setId(null);
|
|
|
- detail.setUserId(processInspecion.getLot().getUserId());
|
|
|
- detail.setProcessInspectionId(processInspecion.getId());
|
|
|
- detail.setDayworkId(0L);
|
|
|
- detail.setProductionPlanId(daywork.getProductionPlanId());
|
|
|
- detail.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
|
|
|
- detail.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
|
|
|
- detail.setLotId(processInspecion.getLot().getId());
|
|
|
- detail.setDayworkItemId(dayworkItem.getId());
|
|
|
- detail.setCheckStandard(inspectionStandardsCheck.getStandard());
|
|
|
- detail.setInspectionStandardsId(inspectionStandardsCheck.getId());
|
|
|
- detailList.add(detail);
|
|
|
- });
|
|
|
- if(!detailList.isEmpty()) {
|
|
|
- processInspectionDetailService.saveBatch(detailList);
|
|
|
- }
|
|
|
- }else {
|
|
|
//保存废品信息
|
|
|
List<BizProcessInspectionDetail> rejects = processInspecion.getProcessInspectionDetails();
|
|
|
//保存前先删除原先废品信息
|
|
@@ -1877,7 +2415,6 @@ public TableDataInfo examineList(@RequestBody BizProcessInspecion bizProcessInsp
|
|
|
});
|
|
|
bizDayworkItemConsultPictureService.saveBatch(pictures);
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
//修改daywaork信息
|
|
|
dayworkItem.setIsProcessInspection(1);
|
|
@@ -1973,6 +2510,7 @@ public TableDataInfo examineList(@RequestBody BizProcessInspecion bizProcessInsp
|
|
|
lot.setDayworkItemId(item.getId());
|
|
|
lot.setCarrierCode(dayworkCarrier.getCarrierCode());
|
|
|
lot.setCarrierId(dayworkCarrier.getCarrierId());
|
|
|
+ lot.setProcessStepNumber(item.getProcessStepNumber());
|
|
|
lot.setPudName(item.getProdNum() == 0 ? lot.getProductionQuantity() : item.getProdNum());
|
|
|
// 获取外协工序列表
|
|
|
BizOutsourcedOrderDetail detail = bizOutsourcedOrderDetailService.getById(detailList.get(0).getOutsourceDetailId());
|
|
@@ -2119,6 +2657,92 @@ public TableDataInfo examineList(@RequestBody BizProcessInspecion bizProcessInsp
|
|
|
return success(lot);
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/getLotInfoByFirstInspection")
|
|
|
+ public AjaxResult getLotInfoByFirstInspection(@RequestBody BizDayworkCarrier dayworkCarrier) throws NoSuchFieldException, IllegalAccessException {
|
|
|
+ //获取报工信息
|
|
|
+ List<BizDayworkItem> itemList = bizDayworkItemService.getByDayworkId(dayworkCarrier.getDayworkId())
|
|
|
+ .stream().filter(item ->!item.getStatus().equals("0") && item.getDeptId().equals(dayworkCarrier.getDeptId())).collect(Collectors.toList());
|
|
|
+ if (itemList.size() == 0) {
|
|
|
+ return error("该批次当前工段没有报工");
|
|
|
+ }
|
|
|
+ BizDayworkItem item = itemList.get(0);
|
|
|
+ List<BizDayworkItem> latestList = itemList.stream().filter(v -> v.getProcessStepNumber().equals(item.getProcessStepNumber()) && item.getUserId().equals(SecurityUtils.getLoginUser().getUserId())).collect(Collectors.toList());
|
|
|
+
|
|
|
+ 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) {
|
|
|
+ return error("该批次已批废");
|
|
|
+ }
|
|
|
+ if (lot.getIsAmend() == 1 || lot.getIsWasteRecycling() == 1) {
|
|
|
+ BizLotTechnologicalProcessDetail process = bizLotTechnologicalProcessDetailService.getById(item.getTechnologicalProcessDetailId());
|
|
|
+ lot.setProcessAlias(process.getProcessAlias());
|
|
|
+ lot.setProcessCode(process.getProcessCode());
|
|
|
+ lot.setProcessId(process.getProcessId());
|
|
|
+ } else {
|
|
|
+ BizTechnologicalProcessDetail process = bizTechnologicalProcessDetailService.getById(item.getTechnologicalProcessDetailId());
|
|
|
+ lot.setProcessAlias(process.getProcessAlias());
|
|
|
+ lot.setProcessCode(process.getProcessCode());
|
|
|
+ lot.setProcessId(process.getProcessId());
|
|
|
+ }
|
|
|
+ lot.setAllCarrierName(item.getCarrierName());
|
|
|
+ if(latestList.stream().map(BizDayworkItem::getStatus).collect(Collectors.toList()).contains("0")){
|
|
|
+ if(!latestList.stream().map(BizDayworkItem::getStatus).collect(Collectors.toList()).contains("1")&&!latestList.stream().map(BizDayworkItem::getStatus).collect(Collectors.toList()).contains("2")){
|
|
|
+ return error("该批次未开始加工");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(latestList.stream().map(BizDayworkItem::getStatus).collect(Collectors.toList()).contains("3")) {
|
|
|
+ return error("当前批次,工序已完成");
|
|
|
+ }
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date date = new Date();
|
|
|
+ String startTime = simpleDateFormat.format(date) + " 00:00:00";
|
|
|
+ String endTime = simpleDateFormat.format(date) + " 23:59:59";
|
|
|
+ List<BizDayworkItem> collect = latestList.stream().filter(v -> v.getStatus().equals("1") || v.getStatus().equals("2")).collect(Collectors.toList());
|
|
|
+ lot.setDayworkItemList(collect.stream().filter(info -> {
|
|
|
+ try {
|
|
|
+ if (info.getEndTime() == null) {
|
|
|
+ // 如果为 null,可以选择返回 false(排除该项),或者根据需要处理
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ // 确保 info 的状态为 "1" 或 "2",且结束时间不晚于当天结束时间
|
|
|
+ // 并且结束时间不早于当天开始时间
|
|
|
+ return info.getEndTime().before(sdf.parse(endTime))
|
|
|
+ && info.getEndTime().after(sdf.parse(startTime));
|
|
|
+ } catch (ParseException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ }).collect(Collectors.toList()));
|
|
|
+ //设置仪器室
|
|
|
+ List<BizInspectionChamber> chamberList = bizInspectionChamberService.getList(new BizInspectionChamber());
|
|
|
+ lot.setInspectionChamberList(chamberList);
|
|
|
+ lot.setUserId(SecurityUtils.getLoginUser().getUserId());
|
|
|
+ lot.setNickName(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
+ lot.setDeptName(item.getDeptName());
|
|
|
+ lot.setDayworkItemId(item.getId());
|
|
|
+ lot.setProcessStepNumber(item.getProcessStepNumber());
|
|
|
+ List<BizDayworkCarrier> dayworkCarrierList = bizDayworkCarrierService.query().eq("daywork_id", dayworkCarrier.getDayworkId()).eq("is_changed", 0).list();
|
|
|
+ if(!dayworkCarrierList.isEmpty()) {
|
|
|
+ //如果绑了多个载具,只返回一个
|
|
|
+ lot.setCarrierCode(dayworkCarrierList.get(0).getCarrierCode());
|
|
|
+ lot.setCarrierId(dayworkCarrierList.get(0).getCarrierId());
|
|
|
+ }
|
|
|
+ lot.setPudName(item.getProdNum() == 0 ? lot.getProductionQuantity() : item.getProdNum());
|
|
|
+ return success(lot);
|
|
|
+ }
|
|
|
@PostMapping("/getLotInfoByFactoryInspection")
|
|
|
public AjaxResult getLotInfoByFactoryInspection(@RequestBody BizDayworkCarrier dayworkCarrier) throws NoSuchFieldException, IllegalAccessException {
|
|
|
//根据箱号查询当前绑定信息
|