质量模块功能提交

Leon 4 years ago
parent 69ec898a9d
commit 2047ebc302

@ -2,6 +2,7 @@ package com.foreverwin.mesnac.common.mapper;
import com.foreverwin.mesnac.common.model.InspectionTask;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
@ -15,4 +16,5 @@ import org.springframework.stereotype.Repository;
@Repository
public interface InspectionTaskMapper extends BaseMapper<InspectionTask> {
InspectionTask selectInspectionTaskByTaskNo(@Param("site") String site, @Param("taskNo") String taskNo);
}

@ -1,6 +1,8 @@
package com.foreverwin.mesnac.common.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
@ -17,7 +19,6 @@ import java.time.LocalDateTime;
*/
@TableName("Z_INSPECTION_TASK")
public class InspectionTask extends Model<InspectionTask> {
private static final long serialVersionUID = 1L;
@ -25,7 +26,7 @@ public class InspectionTask extends Model<InspectionTask> {
/**
*
*/
@TableField("HANDLE")
@TableId(value = "HANDLE", type = IdType.INPUT)
private String handle;
/**
*

@ -27,6 +27,8 @@ public interface InspectionTaskService extends IService<InspectionTask> {
List<InspectionTask> selectList(InspectionTask inspectionTask);
InspectionTask getInspectionTaskByTaskNo(String site, String taskNo);
void saveTask(Map<String, Object> paramMap);
Map<String, Object> createTask(Map<String, Object> paramMap);

@ -62,6 +62,11 @@ public class InspectionTaskServiceImpl extends ServiceImpl<InspectionTaskMapper,
return super.list(queryWrapper);
}
@Override
public InspectionTask getInspectionTaskByTaskNo(String site, String taskNo) {
return inspectionTaskMapper.selectInspectionTaskByTaskNo(site, taskNo);
}
@Override
public void saveTask(Map<String, Object> paramMap) {
String site = CommonMethods.getSite();
@ -182,6 +187,20 @@ public class InspectionTaskServiceImpl extends ServiceImpl<InspectionTaskMapper,
taskNo = "H_" + itemNumber + "_" + dateFormat1.format(date);
}
description = "互检检验任务";
} else if (category.equals(Constants.INSPECTION_TYPE_S)) {
if (StringUtil.isBlank(itemNumber)) {
taskNo = "S_" + dateFormat1.format(date);
} else {
taskNo = "S_" + itemNumber + "_" + dateFormat1.format(date);
}
description = "首件检验任务";
} else if (category.equals(Constants.INSPECTION_TYPE_P)) {
if (StringUtil.isBlank(itemNumber)) {
taskNo = "P_" + dateFormat1.format(date);
} else {
taskNo = "P_" + itemNumber + "_" + dateFormat1.format(date);
}
description = "专检检验任务";
} else {
throw new BaseException("生成任务号失败,请传入检验类型!");
}

@ -496,5 +496,9 @@
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectInspectionTaskByTaskNo" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_INSPECTION_TASK
WHERE SITE = #{site} AND TASK_NO = #{taskNo}
</select>
</mapper>

@ -24,6 +24,7 @@ import com.sap.me.demand.ReleaseShopOrderRequest;
import com.sap.me.demand.ReleaseShopOrderResponse;
import com.sap.me.demand.ReleasedSfc;
import com.sap.me.demand.ShopOrderServiceInterface;
import com.sap.me.nonconformance.NCProductionServiceInterface;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -32,6 +33,8 @@ import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import static com.foreverwin.modular.core.meext.PapiServiceEnum.NCProductionService;
/**
*
* ClassName: ShopOrderReleaseServiceImpl
@ -76,6 +79,7 @@ public class ShopOrderReleaseServiceImpl implements ShopOrderReleaseService {
throw new BaseException("请至少选择一笔需要下达的工单");
}
//工单标准服务
ShopOrderServiceInterface shopOrderServiceInterface = null;
try {

@ -249,7 +249,7 @@ public class InterfaceServiceImpl implements InterfaceService {
}
//工艺路线BO
Float revision = new Float(1.0);
String routerType = RouterType.SHOPORDER_SPECIFIC.value();
String routerType = RouterType.SPECIAL.value();
String routerBo = HandleEnum.ROUTER.getHandle(site, router, routerType, revision.toString());
//查询工艺路线是否存在, 不存在版本默认为1.0,存在最大版本+1最为当前版本

@ -0,0 +1,120 @@
package com.foreverwin.mesnac.quality.controller;
import cn.hutool.core.date.DateUtil;
import com.foreverwin.mesnac.common.service.InspectionTaskService;
import com.foreverwin.mesnac.quality.dto.InspectionTaskManageRequest;
import com.foreverwin.mesnac.quality.model.InspectionTaskManage;
import com.foreverwin.mesnac.quality.service.InspectionTaskManageService;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/InspectionTaskManage")
public class InspectionTaskManageController {
@Autowired
private InspectionTaskManageService inspectionTaskManageService;
@ResponseBody
@PostMapping("/findInspectionTask")
public R findInspectionTask(@RequestBody InspectionTaskManageRequest inspectionTaskManageRequest) {
List<InspectionTaskManage> result;
try {
String site = CommonMethods.getSite();
inspectionTaskManageRequest.setSite(site);
if (inspectionTaskManageRequest.getDateFromStr() != null) {
inspectionTaskManageRequest.setDateFrom(DateUtil.parse(inspectionTaskManageRequest.getDateFromStr()));
}
if (inspectionTaskManageRequest.getDateToStr() != null) {
inspectionTaskManageRequest.setDateTo(DateUtil.parse(inspectionTaskManageRequest.getDateToStr()));
}
result = inspectionTaskManageService.findInspectionTask(inspectionTaskManageRequest);
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok(result);
}
@ResponseBody
@PostMapping("/findInspectionTaskDetail")
public R findInspectionTaskDetail(@RequestBody InspectionTaskManageRequest inspectionTaskManageRequest) {
InspectionTaskManage result;
try {
String site = CommonMethods.getSite();
inspectionTaskManageRequest.setSite(site);
result = inspectionTaskManageService.findInspectionTaskAndDetail(inspectionTaskManageRequest);
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok(result);
}
@ResponseBody
@PostMapping("/completeInspectionTask")
public R completeInspectionTask(@RequestBody List<InspectionTaskManageRequest> requestList) {
try {
if (requestList == null || requestList.size() <= 0) {
throw BusinessException.build("请选择至少一笔记录进行操作!");
}
String site = CommonMethods.getSite();
String user = CommonMethods.getUser();
inspectionTaskManageService.completeInspectionTask(site, user, requestList);
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok();
}
@ResponseBody
@PostMapping("/saveInspectionTaskDetail")
public R saveInspectionTaskDetail(@RequestBody InspectionTaskManage inspectionTaskManage) {
try {
String site = CommonMethods.getSite();
String user = CommonMethods.getUser();
inspectionTaskManageService.saveInspectionTaskDetail(site, user, inspectionTaskManage);
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok();
}
@Autowired
private InspectionTaskService inspectionTaskService;
@ResponseBody
@GetMapping("/createTask")
public R createTask(String category, String sfc, String shopOrder, String operation, String stepId) {
try {
CommonMethods.setSite("1000");
Map<String, Object> map = new HashMap<>();
map.put("CATEGORY", category);
map.put("SFC", sfc);
map.put("SHOP_ORDER", shopOrder);
map.put("OPERATION", operation);
map.put("STEP_ID", stepId);
inspectionTaskService.createTask(map);
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok();
}
}

@ -0,0 +1,143 @@
package com.foreverwin.mesnac.quality.dto;
import java.io.Serializable;
import java.util.Date;
public class InspectionTaskManageRequest implements Serializable {
private String handle;
private String site;
private String taskNo;
private String category;
private String status;
private String workCenter;
private String shopOrder;
private String sfc;
private String item;
private String operation;
private String stepId;
private String dateFromStr;
private String dateToStr;
private Date dateFrom;
private Date dateTo;
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getSite() {
return site;
}
public void setSite(String site) {
this.site = site;
}
public String getTaskNo() {
return taskNo;
}
public void setTaskNo(String taskNo) {
this.taskNo = taskNo;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getWorkCenter() {
return workCenter;
}
public void setWorkCenter(String workCenter) {
this.workCenter = workCenter;
}
public String getShopOrder() {
return shopOrder;
}
public void setShopOrder(String shopOrder) {
this.shopOrder = shopOrder;
}
public String getSfc() {
return sfc;
}
public void setSfc(String sfc) {
this.sfc = sfc;
}
public String getItem() {
return item;
}
public void setItem(String item) {
this.item = item;
}
public String getOperation() {
return operation;
}
public void setOperation(String operation) {
this.operation = operation;
}
public String getStepId() {
return stepId;
}
public void setStepId(String stepId) {
this.stepId = stepId;
}
public String getDateFromStr() {
return dateFromStr;
}
public void setDateFromStr(String dateFromStr) {
this.dateFromStr = dateFromStr;
}
public String getDateToStr() {
return dateToStr;
}
public void setDateToStr(String dateToStr) {
this.dateToStr = dateToStr;
}
public Date getDateFrom() {
return dateFrom;
}
public void setDateFrom(Date dateFrom) {
this.dateFrom = dateFrom;
}
public Date getDateTo() {
return dateTo;
}
public void setDateTo(Date dateTo) {
this.dateTo = dateTo;
}
}

@ -0,0 +1,19 @@
package com.foreverwin.mesnac.quality.mapper;
import com.foreverwin.mesnac.quality.dto.InspectionTaskManageRequest;
import com.foreverwin.mesnac.quality.model.InspectionTaskManageDetail;
import com.foreverwin.mesnac.quality.model.InspectionTaskManage;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface InspectionTaskManageMapper {
List<InspectionTaskManage> findInspectionTask(InspectionTaskManageRequest inspectionTaskManageRequest);
List<InspectionTaskManageDetail> selectInspectionItemDetail(@Param("inspectionItemBo") String inspectionItemBo);
List<InspectionTaskManageDetail> selectInspectionTaskDetail(@Param("inspectionTaskBo") String inspectionTaskBo);
}

@ -0,0 +1,218 @@
package com.foreverwin.mesnac.quality.model;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
public class InspectionTaskManage implements Serializable {
private String handle;
private String site;
private String operationType;
private String category;
private String taskNo;
private String description;
private String status;
private String inspectionItemBo;
private String workCenter;
private String shopOrder;
private String sfc;
private String item;
private String itemDescription;
private String operation;
private String stepId;
private String resrce;
private String result;
private String comments;
private String createUser;
private LocalDateTime createdDateTime;
private String modifyUser;
private LocalDateTime modifiedDateTime;
private List<InspectionTaskManageDetail> inspectionTaskDetailList;
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getSite() {
return site;
}
public void setSite(String site) {
this.site = site;
}
public String getOperationType() {
return operationType;
}
public void setOperationType(String operationType) {
this.operationType = operationType;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getTaskNo() {
return taskNo;
}
public void setTaskNo(String taskNo) {
this.taskNo = taskNo;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getInspectionItemBo() {
return inspectionItemBo;
}
public void setInspectionItemBo(String inspectionItemBo) {
this.inspectionItemBo = inspectionItemBo;
}
public String getWorkCenter() {
return workCenter;
}
public void setWorkCenter(String workCenter) {
this.workCenter = workCenter;
}
public String getShopOrder() {
return shopOrder;
}
public void setShopOrder(String shopOrder) {
this.shopOrder = shopOrder;
}
public String getSfc() {
return sfc;
}
public void setSfc(String sfc) {
this.sfc = sfc;
}
public String getItem() {
return item;
}
public void setItem(String item) {
this.item = item;
}
public String getItemDescription() {
return itemDescription;
}
public void setItemDescription(String itemDescription) {
this.itemDescription = itemDescription;
}
public String getOperation() {
return operation;
}
public void setOperation(String operation) {
this.operation = operation;
}
public String getStepId() {
return stepId;
}
public void setStepId(String stepId) {
this.stepId = stepId;
}
public String getResrce() {
return resrce;
}
public void setResrce(String resrce) {
this.resrce = resrce;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public String getComments() {
return comments;
}
public void setComments(String comments) {
this.comments = comments;
}
public String getCreateUser() {
return createUser;
}
public void setCreateUser(String createUser) {
this.createUser = createUser;
}
public LocalDateTime getCreatedDateTime() {
return createdDateTime;
}
public void setCreatedDateTime(LocalDateTime createdDateTime) {
this.createdDateTime = createdDateTime;
}
public String getModifyUser() {
return modifyUser;
}
public void setModifyUser(String modifyUser) {
this.modifyUser = modifyUser;
}
public LocalDateTime getModifiedDateTime() {
return modifiedDateTime;
}
public void setModifiedDateTime(LocalDateTime modifiedDateTime) {
this.modifiedDateTime = modifiedDateTime;
}
public List<InspectionTaskManageDetail> getInspectionTaskDetailList() {
return inspectionTaskDetailList;
}
public void setInspectionTaskDetailList(List<InspectionTaskManageDetail> inspectionTaskDetailList) {
this.inspectionTaskDetailList = inspectionTaskDetailList;
}
}

@ -0,0 +1,189 @@
package com.foreverwin.mesnac.quality.model;
import java.io.Serializable;
import java.math.BigDecimal;
public class InspectionTaskManageDetail implements Serializable {
private String handle;
private String site;
private String seq;
private String taskBo;
private String paramNo;
private String description;
private String inspectionMethod;
private String paramType;
private String paramUnit;
private BigDecimal decimalNum;
private BigDecimal minValue;
private String standardValue;
private BigDecimal maxValue;
private String falseValue;
private String trueValue;
private String isRequired;
private BigDecimal checkNum;
private String checkValues;
private String result;
private String remark;
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getSite() {
return site;
}
public void setSite(String site) {
this.site = site;
}
public String getSeq() {
return seq;
}
public void setSeq(String seq) {
this.seq = seq;
}
public String getTaskBo() {
return taskBo;
}
public void setTaskBo(String taskBo) {
this.taskBo = taskBo;
}
public String getParamNo() {
return paramNo;
}
public void setParamNo(String paramNo) {
this.paramNo = paramNo;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getInspectionMethod() {
return inspectionMethod;
}
public void setInspectionMethod(String inspectionMethod) {
this.inspectionMethod = inspectionMethod;
}
public String getParamType() {
return paramType;
}
public void setParamType(String paramType) {
this.paramType = paramType;
}
public String getParamUnit() {
return paramUnit;
}
public void setParamUnit(String paramUnit) {
this.paramUnit = paramUnit;
}
public BigDecimal getDecimalNum() {
return decimalNum;
}
public void setDecimalNum(BigDecimal decimalNum) {
this.decimalNum = decimalNum;
}
public BigDecimal getMinValue() {
return minValue;
}
public void setMinValue(BigDecimal minValue) {
this.minValue = minValue;
}
public String getStandardValue() {
return standardValue;
}
public void setStandardValue(String standardValue) {
this.standardValue = standardValue;
}
public BigDecimal getMaxValue() {
return maxValue;
}
public void setMaxValue(BigDecimal maxValue) {
this.maxValue = maxValue;
}
public String getFalseValue() {
return falseValue;
}
public void setFalseValue(String falseValue) {
this.falseValue = falseValue;
}
public String getTrueValue() {
return trueValue;
}
public void setTrueValue(String trueValue) {
this.trueValue = trueValue;
}
public String getIsRequired() {
return isRequired;
}
public void setIsRequired(String isRequired) {
this.isRequired = isRequired;
}
public BigDecimal getCheckNum() {
return checkNum;
}
public void setCheckNum(BigDecimal checkNum) {
this.checkNum = checkNum;
}
public String getCheckValues() {
return checkValues;
}
public void setCheckValues(String checkValues) {
this.checkValues = checkValues;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}

@ -0,0 +1,62 @@
package com.foreverwin.mesnac.quality.service;
import com.foreverwin.mesnac.common.model.InspectionItemDetail;
import com.foreverwin.mesnac.quality.dto.InspectionTaskManageRequest;
import com.foreverwin.mesnac.quality.model.InspectionTaskManageDetail;
import com.foreverwin.mesnac.quality.model.InspectionTaskManage;
import java.util.List;
public interface InspectionTaskManageService {
/**
*
*
* @param inspectionTaskManageRequest
* @return
*/
List<InspectionTaskManage> findInspectionTask(InspectionTaskManageRequest inspectionTaskManageRequest);
/**
*
*
* @param inspectionTaskManageRequest
* @return
*/
InspectionTaskManage findInspectionTaskAndDetail(InspectionTaskManageRequest inspectionTaskManageRequest);
/**
*
*
* @param inspectionItemBo
* @return
*/
List<InspectionTaskManageDetail> getInspectionItemDetail(String inspectionItemBo);
/**
*
*
* @param inspectionTaskBo
* @return
*/
List<InspectionTaskManageDetail> getInspectionTaskDetail(String inspectionTaskBo);
/**
*
*
* @param site
* @param user
* @param requestList
*/
void completeInspectionTask(String site, String user, List<InspectionTaskManageRequest> requestList);
/**
*
*
* @param site
* @param user
* @param inspectionTaskManage
*/
void saveInspectionTaskDetail(String site, String user, InspectionTaskManage inspectionTaskManage);
}

@ -0,0 +1,187 @@
package com.foreverwin.mesnac.quality.service.impl;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.model.InspectionTask;
import com.foreverwin.mesnac.common.model.InspectionTaskDetail;
import com.foreverwin.mesnac.common.service.InspectionTaskDetailService;
import com.foreverwin.mesnac.common.service.InspectionTaskService;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.quality.dto.InspectionTaskManageRequest;
import com.foreverwin.mesnac.quality.mapper.InspectionTaskManageMapper;
import com.foreverwin.mesnac.quality.model.InspectionTaskManageDetail;
import com.foreverwin.mesnac.quality.model.InspectionTaskManage;
import com.foreverwin.mesnac.quality.service.InspectionTaskManageService;
import com.foreverwin.modular.core.exception.BusinessException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@Service
@Transactional(rollbackFor = Exception.class)
public class InspectionTaskManageServiceImpl implements InspectionTaskManageService {
@Autowired
private InspectionTaskService inspectionTaskService;
@Autowired
private InspectionTaskManageMapper inspectionTaskManageMapper;
@Autowired
private InspectionTaskDetailService inspectionTaskDetailService;
@Override
public List<InspectionTaskManage> findInspectionTask(InspectionTaskManageRequest inspectionTaskManageRequest) {
return inspectionTaskManageMapper.findInspectionTask(inspectionTaskManageRequest);
}
@Override
public InspectionTaskManage findInspectionTaskAndDetail(InspectionTaskManageRequest inspectionTaskManageRequest) {
List<InspectionTaskManage> manageList = this.findInspectionTask(inspectionTaskManageRequest);
if (manageList == null || manageList.size() <= 0) {
throw BusinessException.build("产品条码没有可执行的检验任务!");
}
String site = inspectionTaskManageRequest.getSite();
InspectionTaskManage inspectionTaskManage = manageList.get(0);
String taskBo = inspectionTaskManage.getHandle();
String inspectionItemBo = inspectionTaskManage.getInspectionItemBo();
//查询检验项目
List<InspectionTaskManageDetail> inspectionItemDetailList = this.getInspectionTaskDetail(taskBo);
if (inspectionItemDetailList == null || inspectionItemDetailList.size() <= 0) {
inspectionItemDetailList = this.getInspectionItemDetail(inspectionItemBo);
if (inspectionItemDetailList == null || inspectionItemDetailList.size() <= 0) {
throw BusinessException.build("没有找到检验项目检验参数!");
}
List<InspectionTaskDetail> taskDetailList = new ArrayList<>();
for (InspectionTaskManageDetail itemDetail : inspectionItemDetailList) {
InspectionTaskDetail inspectionTaskDetail = new InspectionTaskDetail();
inspectionTaskDetail.setHandle(UUID.randomUUID().toString());
inspectionTaskDetail.setSite(site);
inspectionTaskDetail.setTaskBo(taskBo);
inspectionTaskDetail.setInspectionItemDetailBo(itemDetail.getHandle());
taskDetailList.add(inspectionTaskDetail);
BigDecimal checkNum = itemDetail.getCheckNum();
if (checkNum.compareTo(BigDecimal.ONE) == 1) {
for (int i = 0; i < checkNum.intValue()-1; i++) {
InspectionTaskDetail taskDetail = new InspectionTaskDetail();
BeanUtils.copyProperties(inspectionTaskDetail, taskDetail);
taskDetail.setHandle(UUID.randomUUID().toString());
taskDetailList.add(taskDetail);
}
}
}
if (taskDetailList != null && taskDetailList.size() > 0) {
inspectionTaskDetailService.saveBatch(taskDetailList);
}
inspectionItemDetailList = this.getInspectionTaskDetail(taskBo);
}
inspectionTaskManage.setInspectionTaskDetailList(inspectionItemDetailList);
return inspectionTaskManage;
}
@Override
public List<InspectionTaskManageDetail> getInspectionItemDetail(String inspectionItemBo) {
return inspectionTaskManageMapper.selectInspectionItemDetail(inspectionItemBo);
}
@Override
public List<InspectionTaskManageDetail> getInspectionTaskDetail(String inspectionTaskBo) {
return inspectionTaskManageMapper.selectInspectionTaskDetail(inspectionTaskBo);
}
@Override
public void completeInspectionTask(String site, String user, List<InspectionTaskManageRequest> requestList) {
if (requestList == null || requestList.size() <= 0) {
return;
}
LocalDateTime dateTime = LocalDateTime.now();
List<InspectionTask> inspectionTaskList = new ArrayList<>();
for (InspectionTaskManageRequest request : requestList) {
String status = request.getStatus();
String taskNo = request.getTaskNo();
if (!Constants.INSPECTION_TASK_STATUS_NEW.equals(status)) {
throw BusinessException.build("任务【" +taskNo+ "】不是新建状态,不允许执行合格操作");
}
//修改数据
InspectionTask inspectionTask = new InspectionTask();
inspectionTask.setHandle(request.getHandle());
inspectionTask.setResult("OK");
inspectionTask.setStatus(Constants.INSPECTION_TASK_STATUS_COMPLETE);
inspectionTask.setModifyUser(user);
inspectionTask.setModifiedDateTime(dateTime);
inspectionTaskList.add(inspectionTask);
}
if (inspectionTaskList != null && inspectionTaskList.size() > 0) {
inspectionTaskService.updateBatchById(inspectionTaskList);
}
}
@Override
public void saveInspectionTaskDetail(String site, String user, InspectionTaskManage inspectionTaskManage) {
List<InspectionTaskManageDetail> taskDetailList = inspectionTaskManage.getInspectionTaskDetailList();
if (taskDetailList == null || taskDetailList.size() <= 0) {
return;
}
LocalDateTime dateTime = LocalDateTime.now();
String taskNo = inspectionTaskManage.getTaskNo();
String type = inspectionTaskManage.getOperationType();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
List<InspectionTaskDetail> inspectionTaskDetailList = new ArrayList<>();
//修改明细数据
for (InspectionTaskManageDetail manageDetail : taskDetailList) {
String isRequired = manageDetail.getIsRequired();
String paramNo = manageDetail.getParamNo();
String checkValues = manageDetail.getCheckValues();
if ("Y".equals(isRequired) && StringUtil.isBlank(checkValues) && "SUBMIT".equals(type)) {
throw BusinessException.build("检验项目【" +paramNo+"】值必输!");
}
InspectionTaskDetail taskDetail = new InspectionTaskDetail();
taskDetail.setHandle(manageDetail.getHandle());
taskDetail.setCheckValues(checkValues);
taskDetail.setResult(manageDetail.getResult());
taskDetail.setRemark(manageDetail.getRemark());
taskDetail.setCheckUser(user);
taskDetail.setCheckDate(dateTime);
inspectionTaskDetailList.add(taskDetail);
}
if (inspectionTaskDetailList != null && inspectionTaskDetailList.size() > 0) {
inspectionTaskDetailService.updateBatchById(inspectionTaskDetailList);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//修改主表数据
InspectionTask inspectionTaskModel = inspectionTaskService.getInspectionTaskByTaskNo(site, taskNo);
if (inspectionTaskModel == null) {
throw BusinessException.build("检验任务【" +taskNo+ "】不存在!");
}
String status = inspectionTaskModel.getStatus();
if (!Constants.INSPECTION_TASK_STATUS_NEW.equals(status) && !Constants.INSPECTION_TASK_STATUS_DOING.equals(status)) {
throw BusinessException.build("检验任务【" +taskNo+ "】不是【新建|检验中】,不允许操作!");
}
inspectionTaskModel.setStatus("SAVE".equals(type) ? Constants.INSPECTION_TASK_STATUS_DOING : Constants.INSPECTION_TASK_STATUS_COMPLETE);
inspectionTaskModel.setResult(inspectionTaskManage.getResult());
inspectionTaskModel.setComments(inspectionTaskManage.getComments());
inspectionTaskModel.setModifyUser(user);
inspectionTaskModel.setModifiedDateTime(dateTime);
inspectionTaskService.updateById(inspectionTaskModel);
}
}

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.foreverwin.mesnac.quality.mapper.InspectionTaskManageMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.quality.model.InspectionTaskManage">
<result column="HANDLE" property="handle" />
<result column="SITE" property="site" />
<result column="CATEGORY" property="category" />
<result column="TASK_NO" property="taskNo" />
<result column="DESCRIPTION" property="description" />
<result column="STATUS" property="status" />
<result column="INSPECTION_ITEM_BO" property="inspectionItemBo" />
<result column="WORK_CENTER" property="workCenter" />
<result column="SHOP_ORDER" property="shopOrder" />
<result column="SFC" property="sfc" />
<result column="ITEM" property="item" />
<result column="ITEM_DESCRIPTION" property="itemDescription" />
<result column="OPERATION" property="operation" />
<result column="STEP_ID" property="stepId" />
<result column="RESRCE" property="resrce" />
<result column="RESULT" property="result" />
<result column="COMMENTS" property="comments" />
<result column="CREATE_USER" property="createUser" />
<result column="CREATED_DATE_TIME" property="createdDateTime" />
<result column="MODIFY_USER" property="modifyUser" />
<result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
</resultMap>
<select id="findInspectionTask" resultMap="BaseResultMap">
SELECT B.HANDLE, B.SITE, B.CATEGORY, B.TASK_NO, B.DESCRIPTION, B.STATUS, B.INSPECTION_ITEM_BO, B.WORK_CENTER, B.SHOP_ORDER, B.SFC, B.OPERATION, B.STEP_ID, B.RESRCE, B.RESULT, B.COMMENTS, B.CREATE_USER, B.CREATED_DATE_TIME, B.MODIFY_USER, B.MODIFIED_DATE_TIME,
M.ITEM, Z.DESCRIPTION ITEM_DESCRIPTION
FROM Z_INSPECTION_TASK B
INNER JOIN SFC S ON S.SITE = B.SITE AND S.SFC = B.SFC
INNER JOIN SHOP_ORDER P ON P.HANDLE = S.SHOP_ORDER_BO
INNER JOIN ITEM M ON M.HANDLE = P.ITEM_BO
LEFT JOIN ITEM_T Z ON Z.ITEM_BO = M.HANDLE AND Z.LOCALE = 'zh'
WHERE B.SITE = #{site}
<if test="workCenter != null and workCenter != ''">
AND B.WORK_CENTER = #{workCenter}
</if>
<if test="category != null and category != ''">
AND B.CATEGORY = #{category}
</if>
<if test="status != null and status != ''">
AND B.STATUS = #{status}
</if>
<if test="shopOrder != null and shopOrder != ''">
AND B.SHOP_ORDER = #{shopOrder}
</if>
<if test="sfc != null and sfc != ''">
AND B.SFC = #{sfc}
</if>
<if test="item != null and item != ''">
AND M.ITEM = #{item}
</if>
<if test="operation != null and operation != ''">
AND B.OPERATION = #{operation}
</if>
<if test="stepId != null and stepId != ''">
AND B.STEP_ID = #{stepId}
</if>
<if test="dateFrom != null">
AND B.CREATED_DATE_TIME >= #{dateFrom}
</if>
<if test="dateTo != null">
AND B.CREATED_DATE_TIME &lt;= #{dateTo}
</if>
</select>
<select id="selectInspectionTaskDetail" resultType="com.foreverwin.mesnac.quality.model.InspectionTaskManageDetail" flushCache="true">
SELECT ZD.HANDLE, ZD.TASK_BO, ZD.SITE, ZL.SEQ, ZL.PARAM_TYPE, ZL.INSPECTION_METHOD, ZL.PARAM_NO, ZL.DESCRIPTION, ZL.MIN_VALUE, ZL.STANDARD_VALUE, ZL.MAX_VALUE, ZL.IS_REQUIRED,
ZL.TRUE_VALUE, ZL.FALSE_VALUE, ZL.CHECK_NUM, ZD.CHECK_VALUES, ZD.RESULT, ZD.REMARK
FROM Z_INSPECTION_TASK_DETAIL ZD
INNER JOIN Z_INSPECTION_ITEM_DETAIL ZL ON ZD.INSPECTION_ITEM_DETAIL_BO = ZL.HANDLE
WHERE ZD.TASK_BO = #{inspectionTaskBo}
</select>
<select id="selectInspectionItemDetail" resultType="com.foreverwin.mesnac.quality.model.InspectionTaskManageDetail">
SELECT ZL.HANDLE, ZL.SEQ, ZL.PARAM_TYPE, ZL.PARAM_NO, ZL.DESCRIPTION, ZL.INSPECTION_METHOD, ZL.MIN_VALUE, ZL.STANDARD_VALUE, ZL.MAX_VALUE, ZL.TRUE_VALUE, ZL.FALSE_VALUE, ZL.CHECK_NUM, ZL.IS_REQUIRED
FROM Z_INSPECTION_ITEM_DETAIL ZL
WHERE ZL.INSPECTION_ITEM_BO = #{inspectionItemBo}
</select>
</mapper>
Loading…
Cancel
Save