Compare commits

..

No commits in common. "036ce253b375c2614b1c7f35bcb2eedec96d4dea" and "25cdb4b077105f1eb76c981867ae8dd6003e346d" have entirely different histories.

12 changed files with 67 additions and 147 deletions

View File

@ -220,7 +220,6 @@ public class BackApplyController extends BaseController {
}
for (BackApplyInfo backApplyInfo : record.getBackApplyDetails()) {
backApplyInfo.setParentId(record.getParentId());
backApplyService.updateBackInfo(record.getParentId(),record.getCompanyId());
boolean re = backApplyService.upload(backApplyInfo) > 0;
if (!re) {
return AjaxResult.error("退料任务明细插入失败");

View File

@ -5,7 +5,6 @@ import com.bonus.sgzb.app.domain.BmAgreementInfo;
import com.bonus.sgzb.app.domain.MachinePart;
import com.bonus.sgzb.app.domain.TmTask;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -42,13 +41,11 @@ public interface BackApplyAppMapper {
int del(BackApplyInfo record);
List<BackApplyInfo> examineList(BackApplyInfo record);
List<BackApplyInfo> examineListByUser(BackApplyInfo record);
List<BackApplyInfo> examineView(BackApplyInfo record);
int audit(BackApplyInfo record);
int updateBackApply(BackApplyInfo record);
List<BackApplyInfo> selectBackApplyInfo(BackApplyInfo record);
@ -60,6 +57,4 @@ public interface BackApplyAppMapper {
List<TmTask> getMaTypeDetails(BackApplyInfo backApplyInfo);
MachinePart getMachineParts(TmTask typeId);
void updateBackInfo(@Param("parentId") Integer parentId,@Param("companyId") String companyId);
}

View File

@ -112,6 +112,4 @@ public interface BackApplyService {
* @return int
*/
int refuse(BackApplyInfo record);
void updateBackInfo(Integer parentId,String companyId);
}

View File

@ -205,9 +205,4 @@ public class BackApplyServiceImpl implements BackApplyService {
return 0;
}
@Override
public void updateBackInfo(Integer parentId,String companyId) {
backApplyMapper.updateBackInfo(parentId,companyId);
}
}

View File

@ -215,8 +215,22 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
// 插入领料出库明细表lease_out_details
res = leaseOutDetailsMapper.insertSelective(record);
if (res > 0) {
if (record.getManageType() == 2) {
// 成套机具减少 (ma_type 设备规格表)的库存数量
res = leaseOutDetailsMapper.updateMaTypeStockNum(record);
// 成套机具减少 (ma_type 设备规格表)配件的库存数量
List<TmTask> typeIds = leaseOutDetailsMapper.getMaTypeDetails(record);
typeIds.removeIf(item -> item == null);
for (TmTask typeId : typeIds) {
MachinePart machinePart = leaseOutDetailsMapper.getMachineParts(typeId);
machinePart.setPartNum((typeId.getPartNum() * record.getOutNum()));
typeId.setNum(machinePart.getNum() - machinePart.getPartNum());
res = leaseOutDetailsMapper.updateMaTypeStockNumCt(typeId);
}
} else {
// 普通机具减少 (ma_type 设备规格表)的库存数量
res = leaseOutDetailsMapper.updateMaTypeStockNum(record);
}
// 更新 (ma_machine 设备表)的状态
leaseOutDetailsMapper.updateMaMachineStatus(record);
}

View File

@ -153,12 +153,6 @@ public class RepairTask {
/** 驳回原因 */
private String remark;
/** 待修状态为已完成的typeId */
private String typeId;
/** 待修状态为已完成的typeId */
private String typeIds;
/** 待修状态为已完成的maId */
private String maId;
/** 0未提交 1已提交 */
private Integer commit;
}

View File

@ -56,8 +56,6 @@ public class RepairTaskDetails {
*/
@ApiModelProperty(value = "维修报废数量")
private int scrapNum;
@ApiModelProperty(value = "是否提交0未提交 1已提交")
private Integer commit;
/**
* 待修状态
*/

View File

@ -1,16 +1,13 @@
package com.bonus.sgzb.base.mapper;
import com.bonus.sgzb.app.domain.TmTask;
import com.bonus.sgzb.base.domain.RepairApplyRecord;
import com.bonus.sgzb.base.domain.RepairPartDetails;
import com.bonus.sgzb.base.domain.RepairTask;
import com.bonus.sgzb.base.domain.RepairTaskDetails;
import com.bonus.sgzb.base.domain.vo.DictVo;
import com.bonus.sgzb.system.api.domain.SysUser;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.SelectKey;
import java.math.BigDecimal;
import java.util.ArrayList;
@ -133,7 +130,7 @@ public interface RepairMapper {
* @param task
* @return
*/
int getUnFinish(RepairTaskDetails task);
int getUnFinish(RepairTask task);
/**
* 根据value获取字典数据
@ -166,8 +163,4 @@ public interface RepairMapper {
int addRepairCost(@Param("bean") RepairApplyRecord bean, @Param("costs") BigDecimal costs,@Param("partType") String partType);
List<RepairTask> getRepairTaskListByOne(RepairTask bean);
List<RepairTaskDetails> getRepairMaTypeId(RepairTask repairTask);
int updateCommit(RepairTask task);
}

View File

@ -1,6 +1,5 @@
package com.bonus.sgzb.base.service.impl;
import com.bonus.sgzb.app.domain.TmTask;
import com.bonus.sgzb.base.domain.RepairApplyRecord;
import com.bonus.sgzb.base.domain.RepairPartDetails;
import com.bonus.sgzb.base.domain.RepairTask;
@ -23,7 +22,6 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @author c liu
@ -39,23 +37,23 @@ public class RepairServiceImpl implements RepairService {
public List<RepairTask> getRepairTaskList(RepairTask bean) {
List<RepairTask> repairTaskList = new ArrayList<>();
//判断是查询预报废驳回的维修数据还是退料过来的维修数据
if (bean.getBackSource().equals(BigDecimal.ROUND_DOWN)) {
if(bean.getBackSource().equals(BigDecimal.ROUND_DOWN)){
repairTaskList = mapper.getRepairTaskListByOne(bean);
} else {
}else {
repairTaskList = mapper.getRepairTaskList(bean);
}
if (SecurityUtils.getLoginUser().getRoles().contains("admin")) {
if (SecurityUtils.getLoginUser().getRoles().contains("admin")){
return repairTaskList;
}
List<RepairTask> repairTasks = new ArrayList<>();
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
for (RepairTask repairTask : repairTaskList) {
if (Objects.equals(deptId, 101L) && repairTask.getCompanyIds().contains("101")) {
if (Objects.equals(deptId, 101L) && repairTask.getCompanyIds().contains("101")){
repairTasks.add(repairTask);
}
if (Objects.equals(deptId, 102L) && repairTask.getCompanyIds().contains("102")) {
if (Objects.equals(deptId, 102L) && repairTask.getCompanyIds().contains("102")){
repairTasks.add(repairTask);
}
}
@ -69,13 +67,15 @@ public class RepairServiceImpl implements RepairService {
@Override
public List<RepairTaskDetails> getRepairMaTypeList(RepairTaskDetails bean) {
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
bean.setCompanyId(companyId);
List<RepairTaskDetails> repairMaTypeList = mapper.getRepairMaTypeList(bean);
return repairMaTypeList;
}
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult submitRepairApply(RepairApplyRecord bean) {
public AjaxResult submitRepairApply( RepairApplyRecord bean) {
RepairTaskDetails details = mapper.getById(bean.getId());
LoginUser loginUser = SecurityUtils.getLoginUser();
bean.setCreateBy(loginUser.getUserid());
@ -86,18 +86,18 @@ public class RepairServiceImpl implements RepairService {
String fcType = "2";
String sfPart = "1";
String bsfPart = "0";
if (partList != null && partList.size() > 0) {
if (partList != null && partList.size()>0){
bean.setRepairNum(partList.get(0).getRepairNum());
bean.setRepairer(partList.get(0).getRepairer());
}
switch (bean.getRepairType()) {
case "1": {
case "1":{
int repairNum = details.getRepairedNum() + bean.getRepairNum();
int num = repairNum + details.getScrapNum();
if (num > details.getRepairNum()) {
throw new ServiceException("维修数量大于维修总量");
}
mapper.updateRepairedNum(bean.getId(), repairNum, bean.getRepairer(), loginUser.getUserid());
mapper.updateRepairedNum(bean.getId(), repairNum,bean.getRepairer(),loginUser.getUserid());
break;
}
case "2": {
@ -106,7 +106,7 @@ public class RepairServiceImpl implements RepairService {
if (num > details.getRepairNum()) {
throw new ServiceException("维修数量大于维修总量");
}
mapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid());
mapper.updateRepairedNumTwo(bean.getId(), repairNum,loginUser.getUserid());
break;
}
case "3": {
@ -115,17 +115,17 @@ public class RepairServiceImpl implements RepairService {
if (num > details.getRepairNum()) {
throw new ServiceException("维修数量大于维修总量");
}
mapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid());
mapper.updateScrapNum(bean.getId(), scrapNum,loginUser.getUserid());
break;
}
default:
break;
}
if (partList != null && partList.size() > 0) {
if (nbType.equals(bean.getRepairType())) {
for (RepairPartDetails partDetails : partList) {
if (partDetails.getPartId() != null) {
if (partDetails.getPartCost() == null || partDetails.getPartCost().isEmpty()) {
if (partList != null && partList.size()>0){
if (nbType.equals(bean.getRepairType())){
for (RepairPartDetails partDetails : partList){
if(partDetails.getPartId() != null){
if (partDetails.getPartCost() == null || partDetails.getPartCost().isEmpty()){
partDetails.setPartCost("0");
}
partDetails.setTaskId(bean.getTaskId());
@ -137,44 +137,44 @@ public class RepairServiceImpl implements RepairService {
}
}
}
if (fcType.equals(bean.getRepairType())) {
if (fcType.equals(bean.getRepairType())){
bean.setPartName(partList.get(0).getPartName());
bean.setPartType(partList.get(0).getPartType());
bean.setRepairContent(partList.get(0).getRepairContent());
if (partList.get(0).getSupplierId() == null) {
if (partList.get(0).getSupplierId() == null){
throw new ServiceException("请选择返厂厂家");
} else {
}else {
bean.setSupplierId(partList.get(0).getSupplierId());
}
if (bean.getPartPrice() == null || bean.getPartPrice().isEmpty()) {
if (bean.getPartPrice() == null || bean.getPartPrice().isEmpty()){
bean.setPartPrice("0");
} else {
}else {
bean.setPartPrice(partList.get(0).getPartPrice());
}
bean.setPartNum(partList.get(0).getPartNum());
}
for (RepairPartDetails partDetails : partList) {
if (sfPart.equals(partDetails.getPartType())) {
if (StringUtils.isEmpty(partDetails.getPartCost())) {
for (RepairPartDetails partDetails : partList){
if (sfPart.equals(partDetails.getPartType())){
if (StringUtils.isEmpty(partDetails.getPartCost())){
partDetails.setPartCost("0");
}
BigDecimal partCost = new BigDecimal(partDetails.getPartCost());
sfCosts = sfCosts.add(partCost);
} else if (bsfPart.equals(partDetails.getPartType())) {
if (StringUtils.isEmpty(partDetails.getPartCost())) {
if (StringUtils.isEmpty(partDetails.getPartCost())){
partDetails.setPartCost("0");
}
BigDecimal partCost = new BigDecimal(partDetails.getPartCost());
bsfCosts = bsfCosts.add(partCost);
} else {
} else{
throw new ServiceException("请选择配件收费类型");
}
}
if (!"0".equals(sfCosts.toString())) {
mapper.addRepairCost(bean, sfCosts, sfPart);
if (!"0".equals(sfCosts.toString())){
mapper.addRepairCost(bean,sfCosts,sfPart);
}
if (!"0".equals(bsfCosts.toString())) {
mapper.addRepairCost(bean, bsfCosts, bsfPart);
if (!"0".equals(bsfCosts.toString())){
mapper.addRepairCost(bean,bsfCosts,bsfPart);
}
}
mapper.addRecord(bean);
@ -185,13 +185,13 @@ public class RepairServiceImpl implements RepairService {
@Transactional(rollbackFor = Exception.class)
public AjaxResult fastRepairApply(List<RepairTaskDetails> list) {
LoginUser loginUser = SecurityUtils.getLoginUser();
for (RepairTaskDetails bean : list) {
for (RepairTaskDetails bean : list){
int repairedNum = bean.getRepairNum() - bean.getRepairedNum() - bean.getScrapNum();
if (repairedNum <= 0) {
if (repairedNum <= 0){
throw new ServiceException("选中的数据中包含待维修数量为0的机具请重新选择");
}
}
for (RepairTaskDetails bean : list) {
for (RepairTaskDetails bean : list){
int repairedNum = bean.getRepairNum() - bean.getRepairedNum() - bean.getScrapNum();
RepairApplyRecord partDetails = new RepairApplyRecord();
partDetails.setTaskId(bean.getTaskId());
@ -203,7 +203,7 @@ public class RepairServiceImpl implements RepairService {
partDetails.setCompanyId(bean.getCompanyId());
mapper.addRecord(partDetails);
int i = repairedNum + bean.getRepairedNum();
mapper.updateRepairedNumTwo(bean.getId(), i, loginUser.getUserid());
mapper.updateRepairedNumTwo(bean.getId(),i,loginUser.getUserid());
}
return AjaxResult.success();
}
@ -211,43 +211,20 @@ public class RepairServiceImpl implements RepairService {
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult endRepairTask(List<RepairTask> taskList) {
int num = 0;
LoginUser loginUser = SecurityUtils.getLoginUser();
for (RepairTask task : taskList) {
task.setCreateBy(loginUser.getUserid());
List<RepairTaskDetails> detailsList = new ArrayList<>();
List<RepairTaskDetails> repairMaTypeId = mapper.getRepairMaTypeId(task);
// 判断是否全部维修完成
boolean b = repairMaTypeId.stream().allMatch(t -> "1".equals(t.getStatus()));
if (b) {
// 修改状态为 维修完成
mapper.updateTaskStatus(taskList, loginUser.getUserid());
}
for (RepairTaskDetails repairTaskDetails : repairMaTypeId) {
task.setTypeId(repairTaskDetails.getTypeId());
task.setMaId(repairTaskDetails.getMaId());
List<RepairTaskDetails> list = mapper.getDetailsListByTaskId(task);
// 已经提交过的 再次提交不会再生成一遍
if (list.size() > 0) {
mapper.updateCommit(task);
}
detailsList.addAll(list);
}
List<RepairTaskDetails> collect = repairMaTypeId.stream().filter(t -> t.getCommit() == 0).collect(Collectors.toList());
for (RepairTaskDetails taskDetails : collect) {
taskDetails.setTaskId(task.getTaskId());
int i = mapper.getUnFinish(taskDetails);
if (i > 0) {
num++;
}
}
if (num == 0) {
for (RepairTask task : taskList){
int i = mapper.getUnFinish(task);
if (i > 0){
throw new ServiceException("选中的数据中包含维修未完成的,请完成维修再进行提交审核");
}
}
int i = mapper.updateTaskStatus(taskList,loginUser.getUserid());
for (RepairTask task : taskList){
task.setCreateBy(loginUser.getUserid());
Long agreementId = mapper.getAgreementId(task);
List<RepairTaskDetails> detailsList = mapper.getDetailsListByTaskId(task);
mapper.addTask(task);
for (RepairTaskDetails details : detailsList) {
for (RepairTaskDetails details : detailsList){
details.setCreateBy(loginUser.getUserid());
details.setTaskId(task.getTaskId());
mapper.addAuditDetails(details);
@ -267,7 +244,7 @@ public class RepairServiceImpl implements RepairService {
@Override
public int completeRepair(ArrayList<Long> ids) {
LoginUser loginUser = SecurityUtils.getLoginUser();
return mapper.completeRepair(ids, loginUser.getUserid());
return mapper.completeRepair(ids,loginUser.getUserid());
}
@Override

View File

@ -337,9 +337,6 @@
WHERE
bai.id = #{id}
</update>
<update id="updateBackInfo">
update back_apply_info set company_id = #{companyId} where id = #{parentId}
</update>
<delete id="del">
DELETE

View File

@ -68,16 +68,6 @@
update_time = now()
where id = #{id}
</update>
<update id="updateCommit">
update repair_apply_details set commit = 1
where task_id = #{taskId}
<if test="typeId != null and typeId != ''">
and type_id = #{typeId}
</if>
<if test="maId != null and maId != ''">
and ma_id = #{maId}
</if>
</update>
<select id="getRepairTaskList" resultType="com.bonus.sgzb.base.domain.RepairTask">
SELECT
@ -229,6 +219,9 @@
left join sys_user su on rad.repairer = su.user_id
LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id
where rad.task_id = #{taskId}
<if test="companyId != null and companyId != ''">
and rad.company_id = #{companyId}
</if>
<if test="keyword != null and keyword != ''">
AND (locate(#{keyword}, mm.ma_code) > 0
or locate(#{keyword}, su.nick_name) > 0
@ -270,14 +263,7 @@
<select id="getUnFinish" resultType="java.lang.Integer">
select count(*)
from repair_apply_details
where task_id = #{taskId}
<if test="typeId != null and typeId != ''">
and type_id = #{typeId}
</if>
<if test="maId != null and maId != ''">
and ma_id = #{maId}
</if>
and status = '1'
where task_id = #{taskId} and status = '0'
</select>
<select id="getDicSelect" resultType="com.bonus.sgzb.base.domain.vo.DictVo">
select s2.id,
@ -296,14 +282,6 @@
company_id as companyId
from repair_apply_details
where task_id = #{taskId}
and status = '1'
and commit = 0
<if test="typeId != null and typeId != ''">
and type_id = #{typeId}
</if>
<if test="maId != null and maId != ''">
and ma_id = #{maId}
</if>
</select>
<select id="getRepairTaskListByOne" resultType="com.bonus.sgzb.base.domain.RepairTask">
SELECT
@ -363,23 +341,6 @@
GROUP BY rd.task_id,bui.unit_name,bpi.lot_name,su.nick_name
order by tt.create_time desc
</select>
<select id="getRepairMaTypeId" resultType="com.bonus.sgzb.base.domain.RepairTaskDetails">
SELECT
rad.type_id typeId,
rad.STATUS status,
rad.ma_id maId,
rad.commit commit
FROM
repair_apply_details rad
LEFT JOIN ma_type mt ON rad.type_id = mt.type_id
LEFT JOIN ma_machine mm ON mm.ma_id = rad.ma_id
LEFT JOIN sys_user su ON rad.repairer = su.user_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
WHERE
rad.task_id = #{taskId}
ORDER BY
rad.create_time DESC
</select>
</mapper>

View File

@ -83,7 +83,6 @@
and mws.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
</if>
GROUP BY mws.parent_id,mws.whole_type_name
order by mws.create_time desc
</select>
<select id="selectListById" resultType="com.bonus.sgzb.material.domain.MaWholeVo">
SELECT