Compare commits

...

2 Commits

Author SHA1 Message Date
xiaofajia
ed6140bbd9 Merge branch 'repair' of http://122.51.230.86:3000/dianliang/lanan-system into repair 2024-11-12 09:48:34 +08:00
xiaofajia
9221a7c503 改配件申请 2024-11-12 09:48:14 +08:00
8 changed files with 160 additions and 141 deletions

View File

@ -242,11 +242,9 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
sois.stream().filter(i -> i.getGoodsId().equals(item.getWaresId())).findFirst().ifPresent(repairSoiByTwItem -> {
if (so.getSoType().equals("02")){
dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() - repairSoiByTwItem.getGoodsCount());
dlTwItem.setWaresCouldCount(item.getWaresCouldCount() + repairSoiByTwItem.getGoodsCount());
dlTwItem.setWaresStatus("02");
}else {
dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() + repairSoiByTwItem.getGoodsCount());
dlTwItem.setWaresCouldCount(item.getWaresCouldCount() - repairSoiByTwItem.getGoodsCount());
}
});
newTwItems.add(dlTwItem);

View File

@ -41,22 +41,5 @@ public class DlTwItemController {
public CommonResult<?> listTwItem(DlTwItemReqVO reqVO){
return success(dlTwItemService.listTwItem(reqVO));
}
/**
* 配件客户是否可见
*
* @author 小李
* @date 17:55 2024/10/15
* @param reqVO 请求对象
**/
@GetMapping("/isShow")
@Operation(summary = "配件客户是否可见")
public CommonResult<?> updateIsShow(DlTwItemReqVO reqVO){
DlTwItem dlTwItem = new DlTwItem();
dlTwItem.setIsShow(reqVO.getIsShow());
dlTwItem.setId(reqVO.getId());
dlTwItemService.updateById(dlTwItem);
return CommonResult.ok();
}
}

View File

@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 工单配件申请/退回表
*
@ -17,34 +19,31 @@ import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
public class DlTicketWares extends TenantBaseDO {
/**
* 主键标识
*/
/** 主键标识 */
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
* 单据号(自动生成)
*/
/** 单据号(自动生成) */
private String no;
/**
* 工单ID(dl_repair_tickets表的ID)
*/
/** 工单ID(dl_repair_tickets表的ID) */
private String ticketId;
/**
* 类型(01:领料02:退料ticket_wares_type)
*/
private String type;
/** 用户IDdl_customer_main的userId */
private Long userId;
/**
* 状态(01:待审核02已通过03:全部完成04:部分完成05:已驳回ticket_wares_status)
*/
private String status;
/** 用户名称base_customer_main的cusName */
private String userName;
/** 备注 */
private String remark;
/** 用户电话base_customer_main的phoneNumber */
private String userMobile;
/** 车辆IDbase_car_main的ID */
private String carId;
/** 客户车辆的车牌号dl_repair_tickets中的carNo */
private String licenseNumber;
/** 发起人ID(dl_repair_worker的user_id) */
private Long repairId;
@ -52,12 +51,18 @@ public class DlTicketWares extends TenantBaseDO {
/** 发起人name(dl_repair_worker的user_name) */
private String repairName;
/** 申请人岗位dl_repair_worker的workType */
private String repairWork;
/** 维修顾问ID(system_users的ID) */
private Long adviserId;
/** 维修顾问namesystem_user的nickname */
private String adviserName;
/** 客户车辆的车牌号dl_repair_tickets中的carNo */
private String licenseNumber;
/** 状态01待审批、02已审批、03已驳回ticket_wares_status */
private String status;
/** 备注 */
private String remark;
}

View File

@ -21,49 +21,35 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
public class DlTwItem extends TenantBaseDO {
/**
* 主键标识
*/
/** 主键标识 */
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
* 主表ID(dl_ticket_wares表的ID)
*/
/** 主表ID(dl_ticket_wares表的ID) */
private String twId;
/**
* 配件ID
*/
/** 配件ID */
private String waresId;
/**
* 配件名称
*/
/** 配件名称 */
private String waresName;
/**
* 配件数量
*/
/** 配件数量 */
private Integer waresCount;
/**
* 配件状态(01:已领料02:未领料03已退料,04可确认领料可确认退料 tw_item_status)
*/
/** 已领取数量 */
private Integer waresAlreadyCount;
/** 配件状态:使用字典yes_no1通过0没通过 */
private String waresStatus;
/** 审核人IDsystem_users的ID */
private Long handleId;
/** 审核人姓名system_users的nickname */
private String handleName;
/** 备注 */
private String remark;
/** 客户是否可见(字典yes_no);已存在于系统中(是:1,否:0) */
private String isShow;
/** 可领取数量 */
private Integer waresCouldCount;
/** 已领料数量 */
private Integer waresAlreadyCount;
/** 已退数量 */
private Integer waresBackCount;
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.tickets.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.RecordTypeEnum;
@ -11,6 +12,8 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.base.entity.RepairWorker;
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.project.entity.RepairWares;
import cn.iocoder.yudao.module.project.service.RepairWaresService;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
@ -99,6 +102,9 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
@Resource
private RepairRecordsService repairRecordsService;
@Resource
private CustomerMainService customerMainService;
/**
* 分页查询
*
@ -175,14 +181,40 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
@Override
@DSTransactional
public void updateTicketWares(DlTicketWaresRespVO respVO) {
// 新增修改主表
// 查询操作人的工人信息
RepairWorker one = repairWorkerService.getOne(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()));
respVO.setRepairId(one.getUserId());
respVO.setRepairName(one.getUserName());
baseMapper.insertOrUpdate(respVO);
DlTicketWares ticketWares = BeanUtil.toBean(respVO, DlTicketWares.class);
/*
设置信息
*/
// 用户信息
DlRepairTickets tickets = repairTicketsService.getById(ticketWares.getTicketId());
CustomerMain customerMain = customerMainService.getById(tickets.getUserId());
ticketWares.setUserId(customerMain.getUserId());
ticketWares.setUserName(customerMain.getCusName());
ticketWares.setUserMobile(customerMain.getPhoneNumber());
// 车辆信息
ticketWares.setCarId(tickets.getCarId());
ticketWares.setLicenseNumber(tickets.getCarNo());
// 发起人信息
RepairWorker worker = repairWorkerService.getOne(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()));
ticketWares.setRepairId(worker.getUserId());
ticketWares.setRepairName(worker.getUserName());
ticketWares.setRepairWork(worker.getWorkType());
// 服务顾问信息
ticketWares.setAdviserId(Long.valueOf(tickets.getAdviserId()));
ticketWares.setAdviserName(tickets.getAdviserName());
baseMapper.insertOrUpdate(ticketWares);
// 新增修改子表
List<DlTwItem> list = respVO.getItems().stream().map(item -> item.setTwId(respVO.getId())).collect(Collectors.toList());
List<DlTwItem> list = respVO.getItems().stream()
.map(item -> {
DlTwItem twItem = BeanUtil.toBean(item, DlTwItem.class);
twItem.setTwId(ticketWares.getId());
twItem.setWaresStatus("0");
return twItem;
}).collect(Collectors.toList());
if (CollectionUtil.isEmpty(list)) {
throw exception0(500, "配件列表为空");
}
@ -190,7 +222,6 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
// 通知对应的维修服务顾问和总检
// 维修服务顾问即创建工单时选的是谁
DlRepairTickets tickets = repairTicketsService.getById(respVO.getTicketId());
repairWorkerService.sentMessage(Long.valueOf(tickets.getAdviserId()), "您有新的配件申请单需要审核");
// 总检查角色包含总检的员工
// 取这个角色的角色信息
@ -232,8 +263,6 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
// 设置单据状态
//配件申请单id
String mainId = respVO.getId();
//单据类型现在只有配件申请单 01
String type = respVO.getType();
//单据状态 02 通过 05驳回
String status = respVO.getStatus();
//配件信息
@ -243,7 +272,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
updateObj.setStatus(status);
this.updateById(updateObj);
// 如果是通过并且是领料就还需要把配件信息加入到工单中
if (ObjectUtil.isNotEmpty(status) && status.equals("02") && type.equals("01")) {
if (ObjectUtil.isNotEmpty(status) && status.equals("02")) {
// 更新维修工单
if(null!=respVO.getRepairWaresList()){
repairItemList= new ArrayList<>();
@ -443,10 +472,6 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
Integer waresAlreadyCount = item.getWaresAlreadyCount() == null ? 0 : item.getWaresAlreadyCount();
// 取本来的已领取数量+本次要领取的数量
dlTwItem.setWaresAlreadyCount(repairSoi.getGoodsCount() + waresAlreadyCount);
// 可领取数量就是申请数量-已领料数量
// item是操作的申请配件的数量dlTwItem取最新的已领取数量
dlTwItem.setWaresCouldCount(item.getWaresCount() - dlTwItem.getWaresAlreadyCount());
// dlTwItem.setWaresStatus(repairSoi.getGoodsCount().equals(item.getWaresCount()) ? "04" : item.getWaresStatus());
// 如果已领取数量等于申请数量那这个配件就是领料完了为01已领料反之不变
dlTwItem.setWaresStatus(item.getWaresCount().equals(dlTwItem.getWaresAlreadyCount()) ? "01" : item.getWaresStatus());
});
@ -475,12 +500,9 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
.ifPresent(repairSoi -> {
// 取本来的已领取数量-本次要退料的数量
dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() - repairSoi.getGoodsCount());
// 可领取数量就是上次的可领取+退料数量
// item是操作的可领取数量repairSoi是取本次退料的数量
dlTwItem.setWaresCouldCount(item.getWaresCouldCount() + repairSoi.getGoodsCount());
// dlTwItem.setWaresStatus(repairSoi.getGoodsCount().equals(item.getWaresCount()) ? "04" : item.getWaresStatus());
// 如果可领料数量等于申请数量那这个配件就是退料完了为03已退料反之不变
dlTwItem.setWaresStatus(item.getWaresCount().equals(dlTwItem.getWaresCouldCount()) ? "03" : "02");
dlTwItem.setWaresStatus(item.getWaresCount().equals(dlTwItem.getWaresAlreadyCount()) ? "1" : "0");
});
return dlTwItem;
}).collect(Collectors.toList());
@ -537,21 +559,22 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
@Override
@DSTransactional
public void repairPassTicketWares(DlTicketWaresRespVO respVO) {
// 更新领料申请子表
twItemService.updateBatchById(respVO.getItems());
// 更新领料申请表
// 判断是全部完成完成部分完成
List<DlTwItem> list = twItemService.list(new LambdaQueryWrapper<DlTwItem>().eq(DlTwItem::getTwId, respVO.getId()));
List<DlTwItem> list1 = list.stream().filter(item -> item.getWaresStatus().equals(respVO.getType().equals("01") ? "01" : "03")).collect(Collectors.toList());
respVO.setStatus(list1.size() == list.size() ? "03" : "04");
baseMapper.updateById(respVO);
// 操作库存
list.forEach(item -> {
repairWaresService.update(new LambdaUpdateWrapper<RepairWares>()
.setSql("stock = stock" + (respVO.getType().equals("01") ? "-" : "+") + item.getWaresCount())
.eq(RepairWares::getId, item.getWaresId())
);
});
// todo
// // 更新领料申请子表
// twItemService.updateBatchById(respVO.getItems());
// // 更新领料申请表
// // 判断是全部完成完成部分完成
// List<DlTwItem> list = twItemService.list(new LambdaQueryWrapper<DlTwItem>().eq(DlTwItem::getTwId, respVO.getId()));
// List<DlTwItem> list1 = list.stream().filter(item -> item.getWaresStatus().equals(respVO.getType().equals("01") ? "01" : "03")).collect(Collectors.toList());
// respVO.setStatus(list1.size() == list.size() ? "03" : "04");
// baseMapper.updateById(respVO);
// // 操作库存
// list.forEach(item -> {
// repairWaresService.update(new LambdaUpdateWrapper<RepairWares>()
// .setSql("stock = stock" + (respVO.getType().equals("01") ? "-" : "+") + item.getWaresCount())
// .eq(RepairWares::getId, item.getWaresId())
// );
// });
}
/**
@ -601,8 +624,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
public Map<String, Integer> getWorkerTodo() {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
LambdaQueryWrapper<DlTicketWares> queryWrapper = new LambdaQueryWrapper<DlTicketWares>()
.eq(DlTicketWares::getRepairId, loginUser.getId())
.eq(DlTicketWares::getType, "01");
.eq(DlTicketWares::getRepairId, loginUser.getId());
List<DlTicketWares> list = this.list(queryWrapper);
Map<String, Integer> rtnMap = new HashMap<>();
//所有提交的

View File

@ -5,30 +5,42 @@
<mapper namespace="cn.iocoder.yudao.module.tickets.mapper.DlTicketWaresMapper">
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.tickets.entity.DlTicketWares">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="no" column="no" jdbcType="VARCHAR"/>
<result property="ticketId" column="ticket_id" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="repairId" column="repair_id" />
<result property="repairName" column="repair_name" />
<result property="adviserId" column="adviser_id" />
<result property="adviserName" column="adviser_name" />
<result property="licenseNumber" column="license_number" />
<result property="createTime" column="create_time" />
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="no" column="no" jdbcType="VARCHAR"/>
<result property="ticketId" column="ticket_id" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
<result property="userMobile" column="user_mobile" jdbcType="VARCHAR"/>
<result property="carId" column="car_id" jdbcType="VARCHAR"/>
<result property="licenseNumber" column="license_number" jdbcType="VARCHAR"/>
<result property="repairId" column="repair_id" jdbcType="INTEGER"/>
<result property="repairName" column="repair_name" jdbcType="VARCHAR"/>
<result property="repairWork" column="repair_work" jdbcType="VARCHAR"/>
<result property="adviserId" column="adviser_id" jdbcType="INTEGER"/>
<result property="adviserName" column="adviser_name" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" />
</resultMap>
<sql id="Base_SQL">
select
dtw.id as id,no,ticket_id,
type,status,dtw.remark as remark,
dtw.repair_id as repair_id,
dtw.repair_name as repair_name,
dtw.adviser_id as adviser_id,
dtw.adviser_name as adviser_name,
dtw.license_number as license_number,
dtw.create_time as create_time
dtw.id,
dtw.no,
dtw.ticket_id,
dtw.user_id,
dtw.user_name,
dtw.user_mobile,
dtw.car_id,
dtw.license_number,
dtw.repair_id,
dtw.repair_name,
dtw.repair_work,
dtw.adviser_id,
dtw.adviser_name,
dtw.status,
dtw.remark,
dtw.create_time
from dl_ticket_wares dtw
left join dl_repair_tickets drt
on dtw.ticket_id = drt.id
@ -46,8 +58,14 @@
dtw.license_number like concat('%', #{map.query}, '%')
)
</if>
<if test="map.type != null and map.type != ''">
and (dtw.type = #{map.type})
<if test="map.licenseNumber != null and map.licenseNumber != ''">
and dtw.license_number like concat('%', #{map.licenseNumber}, '%')
</if>
<if test="map.userMobile != null and map.userMobile != ''">
and dtw.user_mobile like concat('%', #{map.userMobile}, '%')
</if>
<if test="map.repairName != null and map.repairName != ''">
and dtw.repair_name like concat('%', #{map.repairName}, '%')
</if>
<if test="map.status != null and map.status != ''">
and (dtw.status = #{map.status})

View File

@ -5,24 +5,30 @@
<mapper namespace="cn.iocoder.yudao.module.tickets.mapper.DlTwItemMapper">
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.tickets.entity.DlTwItem">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="twId" column="tw_id" jdbcType="VARCHAR"/>
<result property="waresId" column="wares_id" jdbcType="VARCHAR"/>
<result property="waresName" column="wares_name" jdbcType="VARCHAR"/>
<result property="waresCount" column="wares_count" jdbcType="INTEGER"/>
<result property="waresStatus" column="wares_status" jdbcType="VARCHAR"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="isShow" column="is_show" />
<result property="waresCouldCount" column="wares_could_count" />
<result property="waresAlreadyCount" column="wares_already_count" />
<result property="waresBackCount" column="wares_back_count" />
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="twId" column="tw_id" jdbcType="VARCHAR"/>
<result property="waresId" column="wares_id" jdbcType="VARCHAR"/>
<result property="waresName" column="wares_name" jdbcType="VARCHAR"/>
<result property="waresCount" column="wares_count" jdbcType="INTEGER"/>
<result property="waresAlreadyCount" column="wares_already_count" jdbcType="INTEGER"/>
<result property="waresStatus" column="wares_status" jdbcType="VARCHAR"/>
<result property="handleId" column="handle_id" jdbcType="INTEGER"/>
<result property="handleName" column="handle_name" jdbcType="VARCHAR"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_SQL">
select
id,tw_id,wares_id,
wares_name,wares_count,wares_status,remark,
is_show,wares_could_count, wares_already_count, wares_back_count
id,
tw_id,
wares_id,
wares_name,
wares_count,
wares_already_count,
wares_status,
handle_id,
handle_name,
remark
from dl_tw_item dti
where dti.deleted = '0'
</sql>

View File

@ -47,6 +47,7 @@ spring:
datasource:
master:
url: jdbc:mysql://122.51.230.86:3306/lanan_platform_dev?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
# url: jdbc:mysql://122.51.230.86:3306/lanan_platform?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例