|
@@ -1,7 +1,6 @@
|
|
|
package cn.ezhizao.project.business.product.controller;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
import javax.annotation.Resource;
|
|
@@ -15,15 +14,15 @@ import cn.ezhizao.framework.web.domain.AjaxResult;
|
|
|
import cn.ezhizao.framework.web.page.TableDataInfo;
|
|
|
import cn.ezhizao.project.business.carrierReject.domain.BizCarrierReject;
|
|
|
import cn.ezhizao.project.business.carrierReject.service.IBizCarrierRejectService;
|
|
|
+import cn.ezhizao.project.business.outsource.domain.BizOutsourcedOrderDetail;
|
|
|
+import cn.ezhizao.project.business.outsource.domain.BizOutsourcedOrderDetailProcess;
|
|
|
+import cn.ezhizao.project.business.outsource.service.IBizOutsourcedOrderDetailService;
|
|
|
import cn.ezhizao.project.business.product.domain.*;
|
|
|
-import cn.ezhizao.project.business.product.mapper.BizDayworkCarrierMapper;
|
|
|
import cn.ezhizao.project.business.product.service.*;
|
|
|
import cn.ezhizao.project.business.technologicalProcessDetail.domain.BizTechnologicalProcessDetail;
|
|
|
import cn.ezhizao.project.business.technologicalProcessDetail.service.IBizTechnologicalProcessDetailService;
|
|
|
import cn.ezhizao.project.system.domain.SysUser;
|
|
|
import cn.ezhizao.project.system.service.ISysUserService;
|
|
|
-import com.baomidou.mybatisplus.annotation.TableField;
|
|
|
-import org.apache.xmlbeans.impl.soap.Detail;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -75,6 +74,8 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
|
|
|
@Resource
|
|
|
private IBizCarrierService bizCarrierService;
|
|
|
+ @Resource
|
|
|
+ private IBizCarrierCategoryService bizCarrierCategoryService;
|
|
|
|
|
|
@Resource
|
|
|
private IBizProductService productService;
|
|
@@ -82,6 +83,10 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
private IBizReturnReceiptDetailService bizReturnReceiptDetailService;
|
|
|
@Resource
|
|
|
private IBizProductionPlanDetailService productionPlanDetailService;
|
|
|
+ @Resource
|
|
|
+ private IBizProcessInspectionDetailService processInspectionDetailService;
|
|
|
+ @Resource
|
|
|
+ private IBizOutsourcedOrderDetailService bizOutsourcedOrderDetailService;
|
|
|
|
|
|
/**
|
|
|
* 查询序检主列表
|
|
@@ -90,14 +95,14 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
@PostMapping("/list")
|
|
|
public TableDataInfo list(@RequestBody BizProcessInspecion bizProcessInspecion) throws NoSuchFieldException, IllegalAccessException {
|
|
|
|
|
|
- if(bizProcessInspecion.getStartTime()!=null) {
|
|
|
+ if (bizProcessInspecion.getStartTime() != null) {
|
|
|
Date startTimeDate = bizProcessInspecion.getStartTime();
|
|
|
// 使用 SimpleDateFormat 格式化 Date 对象为特定格式的字符串
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
|
|
|
- String time= dateFormat.format(startTimeDate);
|
|
|
+ String time = dateFormat.format(startTimeDate);
|
|
|
|
|
|
- bizProcessInspecion.setStartTimeString(time+ " 00:00:00");
|
|
|
- bizProcessInspecion.setEndTimeString(time+ " 23:59:59");
|
|
|
+ bizProcessInspecion.setStartTimeString(time + " 00:00:00");
|
|
|
+ bizProcessInspecion.setEndTimeString(time + " 23:59:59");
|
|
|
}
|
|
|
|
|
|
|
|
@@ -111,14 +116,14 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
// @PreAuthorize("@ss.hasPermi('business:inspecion:list')")
|
|
|
@PostMapping("/outsourcedlist")
|
|
|
public TableDataInfo outsourcedlist(@RequestBody BizProcessInspecion bizProcessInspecion) throws NoSuchFieldException, IllegalAccessException {
|
|
|
- if(bizProcessInspecion.getStartTime()!=null) {
|
|
|
+ if (bizProcessInspecion.getStartTime() != null) {
|
|
|
Date startTimeDate = bizProcessInspecion.getStartTime();
|
|
|
// 使用 SimpleDateFormat 格式化 Date 对象为特定格式的字符串
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
|
|
|
- String time= dateFormat.format(startTimeDate);
|
|
|
+ String time = dateFormat.format(startTimeDate);
|
|
|
|
|
|
- bizProcessInspecion.setStartTimeString(time+ " 00:00:00");
|
|
|
- bizProcessInspecion.setEndTimeString(time+ " 23:59:59");
|
|
|
+ bizProcessInspecion.setStartTimeString(time + " 00:00:00");
|
|
|
+ bizProcessInspecion.setEndTimeString(time + " 23:59:59");
|
|
|
}
|
|
|
List<BizProcessInspecion> list = bizProcessInspecionService.getOutsourcedlist(bizProcessInspecion);
|
|
|
return getDataTable(list);
|
|
@@ -183,8 +188,10 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
public AjaxResult selectOutsourcedInspecion(@RequestBody BizProcessInspecion processInspecion) throws NoSuchFieldException, IllegalAccessException {
|
|
|
List<BizDayworkItemConsult> itemConsults = bizDayworkItemConsultService.query().eq("process_inspection_id", processInspecion.getId()).eq("is_outsourced_inspection", 1).list();
|
|
|
List<BizDayworkItemReject> itemRejects = bizDayworkItemRejectService.query().eq("process_inspection_id", processInspecion.getId()).list();
|
|
|
+ List<BizProcessInspectionDetail> reject = processInspectionDetailService.query().eq("process_inspection_id", processInspecion.getId()).list();
|
|
|
processInspecion.setDayworkItemConsults(itemConsults);
|
|
|
processInspecion.setDayworkItemRejects(itemRejects);
|
|
|
+ processInspecion.setRejects(reject);
|
|
|
|
|
|
BizDayworkItem dayworkItem = bizDayworkItemService.selById(processInspecion.getDayworkItemId());
|
|
|
|
|
@@ -212,7 +219,7 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
/**
|
|
|
* 新增外协序检信息
|
|
|
*/
|
|
|
- @PostMapping("/saveOutsourcedInspecion")
|
|
|
+// @PostMapping("/saveOutsourcedInspecion")
|
|
|
@Transactional
|
|
|
public AjaxResult saveOutsourcedInspecion(@RequestBody BizProcessInspecion processInspecion) throws NoSuchFieldException, IllegalAccessException {
|
|
|
//根据lot信息保存序检表
|
|
@@ -242,13 +249,15 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
processInspecion.setDeptId(daywork.getDeptId());
|
|
|
processInspecion.setProductId(processInspecion.getLot().getProductId());
|
|
|
processInspecion.setTechnologicalProcessId(processInspecion.getLot().getTechnologicalProcessId());
|
|
|
+ processInspecion.setInspectionCarrierCode(processInspecion.getInspectionCarrierCode());
|
|
|
+ processInspecion.setInspectionCarrierId(processInspecion.getInspectionCarrierId());
|
|
|
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());
|
|
|
}
|
|
|
|
|
|
//保存
|
|
@@ -341,7 +350,6 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
processInspecion.setEndTime(new Date());
|
|
|
|
|
|
}
|
|
|
-
|
|
|
//保存
|
|
|
bizProcessInspecionService.saveOrUpdate(processInspecion);
|
|
|
|
|
@@ -397,11 +405,153 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
return success(bizDayworkItemService.saveOrUpdate(dayworkItem) && bizDayworkItemConsultService.saveOrUpdateBatch(consults));
|
|
|
}
|
|
|
|
|
|
+ private boolean checkOutsourceDayworkItem(Long outsourceOrderDetailId) {
|
|
|
+ // 检测外协序检后是否已经周转到下一工序。
|
|
|
+ BizDayworkItem bizDayworkItem = bizDayworkItemService.query().eq("outsource_detail_id", outsourceOrderDetailId).orderByDesc("process_step_number").one();
|
|
|
+ BizDaywork bizDaywork = bizDayworkService.getById(bizDayworkItem.getDayworkId());
|
|
|
+ List<BizDayworkItem> items = bizDayworkItemService.query().eq("daywork_id", bizDayworkItem.getDayworkId()).list();
|
|
|
+ // 下序已经报工
|
|
|
+ // 下序未报工
|
|
|
+ return items.stream().noneMatch(v -> v.getCreateTime().compareTo(bizDayworkItem.getCreateTime()) > 0 && v.getStatus().compareTo("0") >= 0 && v.getStatus().compareTo("3") <= 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ @PostMapping("/saveOutsourcedInspecion")
|
|
|
+ public AjaxResult saveOutsourcedInspectionV2(@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());
|
|
|
+ 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());
|
|
|
+ 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.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());
|
|
|
+ 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(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(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<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());
|
|
|
+ newRej.setRejectNum(newRej.getRejectNum() + reject.getRejectNum());
|
|
|
+ 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);
|
|
|
+ //保存咨询信息
|
|
|
+
|
|
|
+ List<BizDayworkItemConsult> consults = processInspecion.getDayworkItemConsults();
|
|
|
+ if (consults != null && 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) && bizDayworkItemConsultService.saveOrUpdateBatch(consults));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
// /**
|
|
|
// * 根据箱号查询是否为一箱多批
|
|
|
// */
|
|
|
- //原代码备份
|
|
|
+ //原代码备份
|
|
|
// @PostMapping("/getCarrierInfo")
|
|
|
// public AjaxResult getCarrierInfo(@RequestBody BizDayworkCarrier dayworkCarrier) throws NoSuchFieldException, IllegalAccessException {
|
|
|
// List<BizDayworkCarrier> list = bizDayworkCarrierService.getList(dayworkCarrier);
|
|
@@ -415,27 +565,27 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
/**
|
|
|
* 根据箱号查询是否为检查载具,或一箱多批
|
|
|
*/
|
|
|
- @PostMapping("/getCarrierInfo")
|
|
|
+// @PostMapping("/getCarrierInfo")
|
|
|
public AjaxResult getCarrierInfo(@RequestBody BizDayworkCarrier dayworkCarrier) throws NoSuchFieldException, IllegalAccessException {
|
|
|
// List<BizDayworkCarrier> list = bizDayworkCarrierService.query().eq("carrier_code",dayworkCarrier.getCarrierCode()).eq("deleted",0).eq("is_changed",0).list();
|
|
|
dayworkCarrier.setIsChanged(0);
|
|
|
//先查询到箱号信息
|
|
|
- BizCarrier carrier=bizCarrierService.query().eq("code",dayworkCarrier.getCarrierCode()).eq("deleted",0).one();
|
|
|
- if(carrier==null){
|
|
|
+ BizCarrier carrier = bizCarrierService.query().eq("code", dayworkCarrier.getCarrierCode()).eq("deleted", 0).one();
|
|
|
+ if (carrier == null) {
|
|
|
return error("未找到该箱号");
|
|
|
}
|
|
|
//查询箱号是否废弃
|
|
|
- BizCarrierReject carrierReject=bizCarrierRejectService.query().eq("carrier_id",carrier.getId()).eq("deleted",0).one();
|
|
|
- if(carrierReject!=null){
|
|
|
+ BizCarrierReject carrierReject = bizCarrierRejectService.query().eq("carrier_id", carrier.getId()).eq("deleted", 0).one();
|
|
|
+ if (carrierReject != null) {
|
|
|
return error("该载具已废弃");
|
|
|
}
|
|
|
|
|
|
//根据箱号查询绑定信息,如果是检查载具并且没有绑定信息返回载具信息,如果是检查载具且有绑定信息,返回警告
|
|
|
List<BizDayworkCarrier> list = bizDayworkCarrierService.getList(dayworkCarrier);
|
|
|
- if(carrier.getIsInspection().equals(1)&&list.size()==0){
|
|
|
+ if (carrier.getIsInspection().equals(1) && list.size() == 0) {
|
|
|
return success(carrier);
|
|
|
- }else if(carrier.getIsInspection().equals(1)&&list.size()>0){
|
|
|
- return error("检查载具:"+carrier.getCode()+"已经绑定其他批次");
|
|
|
+ } else if (carrier.getIsInspection().equals(1) && list.size() > 0) {
|
|
|
+ return error("检查载具:" + carrier.getCode() + "已经绑定其他批次");
|
|
|
}
|
|
|
if (list.size() == 0) {
|
|
|
throw new RuntimeException("该箱号未绑定任何批次");
|
|
@@ -443,16 +593,52 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
return success(list);
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/getCarrierInfo")
|
|
|
+ public AjaxResult getCarrierInfoByType(@RequestBody BizDayworkCarrier dayworkCarrier) throws NoSuchFieldException, IllegalAccessException {
|
|
|
+ // 判断是哪种箱
|
|
|
+ String carrierCode = dayworkCarrier.getCarrierCode();
|
|
|
+ BizCarrier carrier = bizCarrierService.query().eq("code", carrierCode).one();
|
|
|
+ if (carrier == null) {
|
|
|
+ return error("未找到该箱号");
|
|
|
+ }
|
|
|
+ //查询箱号是否废弃
|
|
|
+ BizCarrierReject carrierReject = bizCarrierRejectService.query().eq("carrier_id", carrier.getId()).eq("deleted", 0).one();
|
|
|
+ if (carrierReject != null) {
|
|
|
+ return error("该载具已废弃");
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ List<BizDayworkCarrier> list = bizDayworkCarrierService.getList(dayworkCarrier);
|
|
|
+ List<BizDaywork> dayworks = bizDayworkService.query().in("id", list.isEmpty() ? Collections.singletonList(0L) : list.stream().map(BizDayworkCarrier::getDayworkId).collect(Collectors.toList())).list();
|
|
|
+ if (carrier.getIsInspection().equals(1)) {
|
|
|
+ // 为检查载具返回检查载具信息
|
|
|
+ if (carrier.getIsInspection().equals(1) && list.size() == 0) {
|
|
|
+ map.put("inspectionCarrier", carrier);
|
|
|
+ return success(map);
|
|
|
+ } else if (carrier.getIsInspection().equals(1) && list.size() > 0) {
|
|
|
+ // 需要显示已经绑定的批次。
|
|
|
+ return error("检查载具:" + carrier.getCode() + "已经绑定其他批次" + dayworks.stream().map(BizDaywork::getLotCode).collect(Collectors.joining()));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (list.size() == 0) {
|
|
|
+ throw new RuntimeException("该箱号未绑定任何批次。");
|
|
|
+ }
|
|
|
+ map.put("dayworkCarriers", list);
|
|
|
+ return success(map);
|
|
|
+ }
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 根据箱号查询批次信息
|
|
|
*/
|
|
|
@PostMapping("/getLotOutsourcedInfo")
|
|
|
public AjaxResult getLotOutsourcedInfo(@RequestBody BizDayworkCarrier dayworkCarrier) throws NoSuchFieldException, IllegalAccessException {
|
|
|
- List<String> codes=new ArrayList<>();
|
|
|
+ List<String> codes = new ArrayList<>();
|
|
|
codes.add("27110");
|
|
|
codes.add("28030");
|
|
|
codes.add("28080");
|
|
|
- List<String> processCodes = dayworkCarrier.getProcessCode()==null?codes:dayworkCarrier.getProcessCode();
|
|
|
+ List<String> processCodes = dayworkCarrier.getProcessCode() == null ? codes : dayworkCarrier.getProcessCode();
|
|
|
System.out.println("查询工序编码:processCodes" + processCodes);
|
|
|
//根据箱号查询当前绑定信息
|
|
|
dayworkCarrier = bizDayworkCarrierService.getByCarrierCode(dayworkCarrier);
|
|
@@ -521,13 +707,17 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
lot.setCarrierCode(dayworkCarrier.getCarrierCode());
|
|
|
lot.setCarrierId(dayworkCarrier.getCarrierId());
|
|
|
lot.setPudName(item.getProdNum() == 0 ? lot.getProductionQuantity() : item.getProdNum());
|
|
|
+ // 获取外协工序列表
|
|
|
+ BizOutsourcedOrderDetail detail = bizOutsourcedOrderDetailService.getById(detailList.get(0).getOutsourceDetailId());
|
|
|
+ lot.setOutsourceOrderDetailId(detail != null ? detail.getId() : null);
|
|
|
+ lot.setProcessList(detail != null ? detail.getProcessNames() : "");
|
|
|
return success(lot);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据箱号查询批次信息
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermi('business:inspecion:list')")
|
|
|
+// @PreAuthorize("@ss.hasPermi('business:inspection:list')")
|
|
|
@PostMapping("/getLotInfo")
|
|
|
public AjaxResult getLotInfo(@RequestBody BizDayworkCarrier dayworkCarrier) throws NoSuchFieldException, IllegalAccessException {
|
|
|
//根据箱号查询当前绑定信息
|
|
@@ -683,10 +873,47 @@ public class BizProcessInspecionController extends BaseController {
|
|
|
/**
|
|
|
* 删除序检主
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermi('business:inspecion:remove')")
|
|
|
@Log(title = "序检主", businessType = BusinessType.DELETE)
|
|
|
@DeleteMapping("/{ids}")
|
|
|
public AjaxResult remove(@PathVariable List<Long> ids) {
|
|
|
return toAjax(bizProcessInspecionService.removeBatchByIds(ids));
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存序检箱
|
|
|
+ */
|
|
|
+ @Log(title = "序检换箱", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping("/saveInspectionCarrier")
|
|
|
+ public AjaxResult saveInspectionCarrier(@RequestBody BizProcessInspecion bizProcessInspecion) {
|
|
|
+ List<BizDayworkCarrier> bizDayworkCarriers = bizDayworkCarrierService.query().eq("process_inspection_id", bizProcessInspecion.getId()).eq("is_changed", 0).list();
|
|
|
+ BizProcessInspecion current = bizProcessInspecionService.getById(bizProcessInspecion.getId());
|
|
|
+ List<BizDayworkCarrier> newCarriers = bizProcessInspecion.getDayworkCarriers();
|
|
|
+ if (bizProcessInspecion.getStatus().equals(0) && newCarriers.isEmpty()) {
|
|
|
+ return error("该序检未完成,不能解绑载具");
|
|
|
+ }
|
|
|
+ bizDayworkCarriers.forEach(l -> l.setIsChanged(1));
|
|
|
+ bizDayworkCarrierService.updateBatchById(bizDayworkCarriers);
|
|
|
+ if (newCarriers.isEmpty()) {
|
|
|
+ current.setIsInspectionCarrierChanged(1);
|
|
|
+ current.setInspectionCarrierChangedTime(new Date());
|
|
|
+ bizProcessInspecionService.updateById(current);
|
|
|
+ } else {
|
|
|
+ current.setIsInspectionCarrierChanged(0);
|
|
|
+ current.setInspectionCarrierChangedTime(null);
|
|
|
+ current.setInspectionCarrierId(newCarriers.get(0).getCarrierId());
|
|
|
+ current.setInspectionCarrierCode(newCarriers.get(0).getCarrierCode());
|
|
|
+ bizProcessInspecionService.updateById(current);
|
|
|
+ }
|
|
|
+ newCarriers.forEach(l -> {
|
|
|
+ l.setId(null);
|
|
|
+ l.setIsChanged(0);
|
|
|
+ l.setProcessInspectionId(bizProcessInspecion.getId());
|
|
|
+ l.setDayworkId(bizProcessInspecion.getDayworkId());
|
|
|
+ l.setProductionPlanId(bizProcessInspecion.getProductionPlanId());
|
|
|
+ l.setLotId(bizProcessInspecion.getLotId());
|
|
|
+ });
|
|
|
+ bizDayworkCarrierService.saveOrUpdateBatch(newCarriers);
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+
|
|
|
}
|