Compare commits

...

1 Commits
dev ... main

20 changed files with 659 additions and 93 deletions

View File

@ -15,6 +15,7 @@ import com.hcy.admin.vo.sparePartStockAudit.SparePartStockAuditListVo;
import com.hcy.admin.vo.sparePartStockAudit.SparePartStockAuditDetailVo;
import com.hcy.common.constant.GlobalConstant;
import com.hcy.common.core.PageResult;
import com.hcy.common.dto.SparePartStockAuditDto;
import com.hcy.common.dto.order.OrderSparePart;
import com.hcy.common.entity.SparePartAudit.SparePartAudit;
import com.hcy.common.entity.client.Client;
@ -109,64 +110,13 @@ public class SparePartStockAuditServiceImpl implements ISparePartStockAuditServi
Integer page = pageParam.getPageNo();
Integer limit = pageParam.getPageSize();
LambdaQueryWrapper<SparePartStockAudit> queryWrapper = new LambdaQueryWrapper<SparePartStockAudit>()
.eq(SparePartStockAudit::getIsDelete, GlobalConstant.NOT_DELETE)
.eq(params.getReceiptType() != null, SparePartStockAudit::getReceiptType, params.getReceiptType())
.eq(params.getOutInWarehouseType() != null, SparePartStockAudit::getOutInWarehouseType, params.getOutInWarehouseType())
.like(StringUtils.isNotEmpty(params.getReceiptNumber()), SparePartStockAudit::getReceiptNumber, params.getReceiptNumber())
.eq(params.getAuditState() != null, SparePartStockAudit::getAuditState, params.getAuditState())
.eq(params.getWarehouseId() != null, SparePartStockAudit::getWarehouseId, params.getWarehouseId())
.eq(params.getDeliveryMethod() != null, SparePartStockAudit::getDeliveryMethod, params.getDeliveryMethod())
.eq(params.getPurchaseStatus() != null, SparePartStockAudit::getPurchaseStatus, params.getPurchaseStatus())
.ge(StringUtils.isNotEmpty(params.getCreateTimeStart()), SparePartStockAudit::getCreateTime, params.getCreateTimeStart())
.le(StringUtils.isNotEmpty(params.getCreateTimeEnd()), SparePartStockAudit::getCreateTime, params.getCreateTimeEnd())
.orderByDesc(SparePartStockAudit::getCreateTime);
/*if(params.getOrderType() == null){
//如果当前不是配件采购则将配件采购出入库单排除
if (params.getOutInWarehouseType() == null) {
if (params.getReceiptType() == null) {
queryWrapper.isNull(SparePartStockAudit::getPurchaseStatus)
.or(orQuery -> orQuery.ne(SparePartStockAudit::getPurchaseStatus, AuditStateEnum.UNREVIEWED.getStatus())
.ne(SparePartStockAudit::getPurchaseStatus, AuditStateEnum.AUDITED.getStatus())
.ne(SparePartStockAudit::getPurchaseStatus, AuditStateEnum.CANCELED_AUDIT.getStatus())
.ne(SparePartStockAudit::getPurchaseStatus, AuditStateEnum.FILLING_OUT.getStatus()));
} else {
queryWrapper.isNull(SparePartStockAudit::getPurchaseStatus);
}
}else{
if(StringUtils.isEmpty(params.getConsignee())){
queryWrapper.and(query -> query.ne(SparePartStockAudit::getPurchaseStatus, AuditStateEnum.FILLING_OUT.getStatus())
.ne(SparePartStockAudit::getPurchaseStatus,AuditStateEnum.CANCELED_AUDIT.getStatus()));
}else{
queryWrapper.isNotNull(SparePartStockAudit::getPurchaseStatus);
}
}
}*/
if(params.getQueryType() == SparePartStockAuditEnum.PURCHASE.getStatus()){
queryWrapper.isNotNull(SparePartStockAudit::getPurchaseStatus);
}else if(params.getQueryType() == SparePartStockAuditEnum.AUDIT.getStatus()){
queryWrapper.and(query -> query.isNull(SparePartStockAudit::getPurchaseStatus)
.or(orQuery -> orQuery.ne(SparePartStockAudit::getPurchaseStatus, AuditStateEnum.UNREVIEWED.getStatus())
.ne(SparePartStockAudit::getPurchaseStatus, AuditStateEnum.AUDITED.getStatus())
.ne(SparePartStockAudit::getPurchaseStatus, AuditStateEnum.CANCELED_AUDIT.getStatus())
.ne(SparePartStockAudit::getPurchaseStatus, AuditStateEnum.FILLING_OUT.getStatus())));
}else if(params.getQueryType() == SparePartStockAuditEnum.WAREHOUSING.getStatus()
|| params.getQueryType() == SparePartStockAuditEnum.GO_OUT_WAREHOUSE.getStatus()
|| params.getQueryType() == SparePartStockAuditEnum.ALLOT.getStatus()){
queryWrapper.isNull(SparePartStockAudit::getPurchaseStatus);
}else if(params.getQueryType() == SparePartStockAuditEnum.PURCHASE_ORDER.getStatus()){
queryWrapper.and(query -> query.ne(SparePartStockAudit::getPurchaseStatus, AuditStateEnum.FILLING_OUT.getStatus())
.ne(SparePartStockAudit::getPurchaseStatus,AuditStateEnum.CANCELED_AUDIT.getStatus()));
}else if(params.getQueryType() == SparePartStockAuditEnum.APPLY_FOR.getStatus()){
queryWrapper.isNotNull(SparePartStockAudit::getOrderType);
}
SparePartStockAuditDto sparePartStockAuditDto = new SparePartStockAuditDto();
BeanUtils.copyProperties(params, sparePartStockAuditDto);
//领用时间范围,配送方式查询
IPage<SparePartStockAudit> iPage = sparePartStockAuditMapper.selectPage(new Page<>(page, limit), queryWrapper);
IPage<SparePartStockAuditDto> iPage = sparePartStockAuditMapper.page(new Page<>(page, limit), sparePartStockAuditDto);
List<SparePartStockAuditListVo> list = new ArrayList<>();
for (SparePartStockAudit item : iPage.getRecords()) {
for (SparePartStockAuditDto item : iPage.getRecords()) {
SparePartStockAuditListVo vo = new SparePartStockAuditListVo();
BeanUtils.copyProperties(item, vo);
@ -175,18 +125,18 @@ public class SparePartStockAuditServiceImpl implements ISparePartStockAuditServi
if (item.getOrderType() != null) {
User user = userMapper.selectById(item.getCreatorId());
if(user != null){
vo.setCreator(user.getUsername());
item.setConsignee(user.getUsername());
vo.setConsignerPhone(user.getUsername() + "/" + item.getPhone());
vo.setRecipientAndPhone(user.getUsername() + "/" + item.getPhone()); //领料员工/联系电话
vo.setCreator(user.getNickname());
item.setConsignee(user.getNickname());
vo.setConsignerPhone(user.getNickname() + "/" + item.getPhone());
vo.setRecipientAndPhone(user.getNickname() + "/" + item.getPhone()); //领料员工/联系电话
}
} else {
SystemAuthAdmin systemAuthAdmin = systemAuthAdminMapper.findSystemAuthAdminById(item.getCreatorId());
if (systemAuthAdmin != null) {
vo.setCreator(systemAuthAdmin.getUsername());
item.setConsignee(systemAuthAdmin.getUsername());
vo.setConsignerPhone(systemAuthAdmin.getUsername() + "/" + item.getPhone());
vo.setRecipientAndPhone(systemAuthAdmin.getUsername() + "/" + item.getPhone()); //领料员工/联系电话
vo.setCreator(systemAuthAdmin.getNickname());
item.setConsignee(systemAuthAdmin.getNickname());
vo.setConsignerPhone(systemAuthAdmin.getNickname() + "/" + item.getPhone());
vo.setRecipientAndPhone(systemAuthAdmin.getNickname() + "/" + item.getPhone()); //领料员工/联系电话
}
}
@ -215,7 +165,7 @@ public class SparePartStockAuditServiceImpl implements ISparePartStockAuditServi
vo.setRecipientPhone(user.getMobile());
}
} else if (item.getOrderType() != null && item.getOrderType() == SparePartStockAuditEnum.REPAIR_ORDER.getStatus()) {
RepairOrder repairOrder = maintenanceOrderMapper.findRepairOrderById(item.getOrderId());
RepairOrder repairOrder = repairOrderMapper.findRepairOrderById(item.getOrderId());
List<OrderSparePartListVo> orderSparePartListVoList = new ArrayList<>();
List<OrderSparePart> orderSparePartList = orderSparePartMapper.findOrderSparePartByRepairOrderId(item.getOrderId());
@ -271,7 +221,7 @@ public class SparePartStockAuditServiceImpl implements ISparePartStockAuditServi
vo.setExportWarehouseName(exportWarehouseName.getWarehouseName());
}
} else {
Long warehouseId = item.getWarehouseId();
Long warehouseId;
if (item.getImportWarehouse() != null) {
warehouseId = item.getImportWarehouse();
} else {
@ -298,9 +248,6 @@ public class SparePartStockAuditServiceImpl implements ISparePartStockAuditServi
}
}
list.add(vo);
}
@ -353,7 +300,7 @@ public class SparePartStockAuditServiceImpl implements ISparePartStockAuditServi
vo.setRecipient(user.getUsername());
vo.setRecipientPhone(user.getMobile());
} else if (model.getOrderType() != null && model.getOrderType() == SparePartStockAuditEnum.REPAIR_ORDER.getStatus()) {
RepairOrder repairOrder = maintenanceOrderMapper.findRepairOrderById(model.getOrderId());
RepairOrder repairOrder = repairOrderMapper.findRepairOrderById(model.getOrderId());
User user = userMapper.selectById(repairOrder.getReceiverId());
List<OrderSparePartListVo> orderSparePartListVoList = new ArrayList<>();

View File

@ -1,5 +1,7 @@
package com.hcy.common.dto;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hcy.common.entity.SparePartAudit.SparePartAudit;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -84,7 +86,7 @@ public class SparePartStockAuditDto implements Serializable {
private Integer outInWarehouseType; //出入库类别0=采购入库1=库存调拨2=员工领料3=销售出库)
private String workOrderId; //工单号
private String orderId; //订单编号
private Long orderId; //订单编号
private String shippingAddress; //收货地址
private String consigner; //发货人
private String consignerPhone; //发货人联系电话
@ -98,10 +100,16 @@ public class SparePartStockAuditDto implements Serializable {
private Integer recipientNumber; //领用数量
private Integer purchaseStatus; //配件领用状态0=待审核1=未通过2=待管理员审核3=待发货4=待收货5=已完成)
private String purchaseIdea; //采购意见
private String orderType; // 0-检修工单 1-维修工单
private Integer orderType; // 0-检修工单 1-维修工单
private String workOrderNo; //工单号
private Integer queryType; // 0-待审核 1-待发货 2-待收货 3-已完成
private String createTimeStart; //创建时间
private String createTimeEnd; //创建时间
private Integer isDelete; // 是否删除: [0=否, 1=是]
private Date createTime; // 创建时间
private Date consignerTime; //发货时间
private Integer creatorId; // 创建人id
private Long auditorId; // 审核人id 经办人
}

View File

@ -44,6 +44,7 @@ public class MaintenanceOrder implements Serializable {
private String cancelCause; // 取消原因
private String refuseMaintenanceCause; // 拒绝维修原因
private String returnCause; //退回原因
private String postponeCause; //暂缓原因
private String remark; // 备注
private Long creatorId; // 创建人id
private Date orderAccomplishTime; // 订单完成时间

View File

@ -21,6 +21,7 @@ public enum MaintenanceOrderStatusEnum {
CHARGEBACK(7,"已退单"),
CLOSED(8,"已关闭"),
RETURNED(9,"已退回"),
POSTPONE(10,"暂缓订单"),
NEAREST_TO_ME(0,"离我最近"),
TIME_PRIORITY(1,"时间优先"),

View File

@ -31,16 +31,6 @@ public interface MaintenanceOrderMapper extends IBaseMapper<MaintenanceOrder> {
@Select("select * from la_maintenance_order where is_delete = 0 and order_no like concat('%',#{time},'%') order by order_no desc limit 1")
MaintenanceOrder findLastMaintenanceOrderByTime(@Param("time") String time);
/**
* id
* @return MaintenanceOrder
*/
@Select("select * from la_repair_order where is_delete = 0 and id = #{id}")
RepairOrder findRepairOrderById(@Param("id") Long id);
@Select("select * from la_repair_order where is_delete = 0 and order_no like concat('%',#{time},'%') order by order_no desc limit 1")
RepairOrder findRepairOrderByTime(@Param("time") String time);
/**
*
* @return

View File

@ -1,7 +1,10 @@
package com.hcy.common.mapper.sparePartStockAudit;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hcy.common.core.basics.IBaseMapper;
import com.hcy.common.dto.SparePartStockAuditDto;
import com.hcy.common.dto.staff.StaffDto;
import com.hcy.common.entity.order.MaintenanceOrder;
import com.hcy.common.entity.sparePartStockAudit.SparePartStockAudit;
import org.apache.ibatis.annotations.Mapper;
@ -14,6 +17,11 @@ import org.apache.ibatis.annotations.Select;
@Mapper
public interface SparePartStockAuditMapper extends IBaseMapper<SparePartStockAudit> {
/**
*
* @param time
* @return SparePartStockAudit
*/
@Select("select * from la_spare_part_stock_audit where is_delete = 0 and receipt_number like concat('%',#{time},'%') order by receipt_number desc limit 1")
SparePartStockAudit findLastSparePartStockAuditByTime(@Param("time") String time);
@ -32,4 +40,12 @@ public interface SparePartStockAuditMapper extends IBaseMapper<SparePartStockAud
*/
@Select("select * from la_spare_part_stock_audit where is_delete = 0 and order_type = #{orderType} and order_id = #{orderId}")
SparePartStockAudit findSparePartStockAuditByOrderId(@Param("orderId") Long orderId,@Param("orderType") Integer orderType);
/**
*
* @param page
* @param sparePartStockAuditDto
* @return Page<SparePartStockAuditDto>
*/
Page<SparePartStockAuditDto> page(Page page, @Param("param") SparePartStockAuditDto sparePartStockAuditDto);
}

View File

@ -2,5 +2,65 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hcy.common.mapper.sparePartStockAudit.SparePartStockAuditMapper">
<select id="page" resultType="com.hcy.common.dto.SparePartStockAuditDto">
SELECT
lspsa.*
FROM
la_spare_part_stock_audit AS lspsa
<if test="param.queryType != null and param.queryType == 6 and param.consignee != null and param.consignee != ''">
LEFT JOIN la_system_auth_admin AS lsaa ON lsaa.id = lspsa.creator_id
</if>
<if test="param.queryType != null and param.queryType == 5 and param.consignee != null and param.consignee != ''">
LEFT JOIN la_user AS lu ON lu.id = lspsa.creator_id
</if>
<where>
lspsa.is_delete = 0
<if test="param.receiptType != null">
and lspsa.receipt_type = #{param.receiptType}
</if>
<if test="param.outInWarehouseType != null">
and lspsa.out_in_warehouse_type = #{param.outInWarehouseType}
</if>
<if test="param.receiptNumber != null and param.receiptNumber != ''">
and lspsa.receipt_number like CONCAT("%",#{param.receiptNumber},"%")
</if>
<if test="param.auditState != null">
and lspsa.audit_state = #{param.auditState}
</if>
<if test="param.warehouseId != null">
and lspsa.warehouse_id = #{param.warehouseId}
</if>
<if test="param.deliveryMethod != null">
and lspsa.delivery_method = #{param.deliveryMethod}
</if>
<if test="param.purchaseStatus != null">
and lspsa.purchase_status = #{param.purchaseStatus}
</if>
<if test="param.createTimeStart != null and param.createTimeStart != ''">
and lspsa.create_time &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null and param.createTimeEnd != ''">
and lspsa.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.queryType != null and (param.queryType == 0 or param.queryType == 5)">
and lspsa.purchase_status is not null
<if test="param.consignee != null and param.consignee != ''">
and lu.nickname like CONCAT("%",#{param.consignee},"%")
</if>
</if>
<if test="param.queryType != null and param.queryType == 1">
and (lspsa.purchase_status is null or (lspsa.purchase_status != 0 and lspsa.purchase_status != 1 and lspsa.purchase_status != 8 and lspsa.purchase_status != 6))
</if>
<if test="param.queryType != null and (param.queryType == 2 or param.queryType == 3 or param.queryType == 4)">
and lspsa.purchase_status is null
</if>
<if test="param.queryType != null and param.queryType == 6">
and (lspsa.purchase_status != 6 and lspsa.purchase_status != 8)
<if test="param.consignee != null and param.consignee != ''">
and lsaa.nickname like CONCAT("%",#{param.consignee},"%")
</if>
</if>
</where>
order by lspsa.create_time desc
</select>
</mapper>

View File

@ -9,6 +9,7 @@ import com.hcy.front.validate.order.MaintenanceOrderParam;
import com.hcy.front.vo.order.MaintenanceOrderDetailVo;
import com.hcy.front.vo.order.MaintenanceOrderListVo;
import lombok.extern.java.Log;
import org.springframework.util.Assert;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -144,6 +145,8 @@ public class MaintenanceOrderController {
*/
@PostMapping("/fillInReceipt")
public Object fillInReceipt(@RequestBody MaintenanceOrderParam maintenanceOrderParam) {
Assert.notNull(maintenanceOrderParam.getFamiliarFaultId(), "结论类型不可为空");
Assert.notNull(maintenanceOrderParam.getFamiliarFaultDescription(), "结论描述不可为空");
iMaintenanceOrderService.fillInReceipt(maintenanceOrderParam);
return AjaxResult.success();
}
@ -155,6 +158,8 @@ public class MaintenanceOrderController {
*/
@PostMapping("/updateEquipmentModel")
public Object updateEquipmentModel(@RequestBody MaintenanceOrderParam maintenanceOrderParam) {
Assert.notNull(maintenanceOrderParam.getModelNo(), "模块编码不可为空");
Assert.notNull(maintenanceOrderParam.getBrand(), "品牌不可为空");
iMaintenanceOrderService.updateEquipmentModel(maintenanceOrderParam);
return AjaxResult.success();
}
@ -181,6 +186,18 @@ public class MaintenanceOrderController {
return AjaxResult.success();
}
/**
*
* @param maintenanceOrderParam
* @return Object
*/
@PostMapping("/postponeOrder")
public Object postponeOrder(@RequestBody MaintenanceOrderParam maintenanceOrderParam) {
Assert.notNull(maintenanceOrderParam.getPostponeCause(), "暂缓原因不可为空");
iMaintenanceOrderService.postponeOrder(maintenanceOrderParam);
return AjaxResult.success();
}
/**
*
* @return Object

View File

@ -0,0 +1,64 @@
package com.hcy.front.controller.sparePartStockAudit;
import com.hcy.common.core.AjaxResult;
import com.hcy.common.core.PageResult;
import com.hcy.common.validator.annotation.IDMust;
import com.hcy.front.service.sparePartStockAudit.ISparePartStockAuditService;
import com.hcy.front.validate.PageParam;
import com.hcy.front.validate.sparePartStockAudit.SparePartStockAuditParam;
import com.hcy.front.vo.sparePartStockAudit.SparePartStockAuditDetailVo;
import com.hcy.front.vo.sparePartStockAudit.SparePartStockAuditListVo;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
*
*/
@RestController
@RequestMapping("api/sparePartStockAudit")
public class SparePartStockAuditController {
@Resource
ISparePartStockAuditService iSparePartStockAuditService;
/**
*
*
* @author hcy
* @param pageParam
* @param params
* @return Object
*/
@GetMapping("/list")
public Object list(@Validated PageParam pageParam, SparePartStockAuditParam params) {
PageResult<SparePartStockAuditListVo> list = iSparePartStockAuditService.list(pageParam, params);
return AjaxResult.success(list);
}
/**
*
*
* @author hcy
* @param id ID
* @return Object
*/
@GetMapping("/detail")
public Object detail(@Validated @IDMust() @RequestParam("id") Long id) {
SparePartStockAuditDetailVo detail = iSparePartStockAuditService.detail(id);
return AjaxResult.success(detail);
}
/**
*
*
* @author hcy
* @param sparePartStockAuditParam
* @return Object
*/
@PostMapping("/add")
public Object add(@Validated(value = SparePartStockAuditParam.create.class) @RequestBody SparePartStockAuditParam sparePartStockAuditParam) {
iSparePartStockAuditService.add(sparePartStockAuditParam);
return AjaxResult.success();
}
}

View File

@ -8,6 +8,7 @@ import com.hcy.front.validate.PageParam;
import com.hcy.front.validate.warehouse.SparePartParam;
import com.hcy.front.vo.warehouse.SparePartDetailVo;
import com.hcy.front.vo.warehouse.SparePartListVo;
import org.springframework.util.Assert;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -26,20 +27,22 @@ public class SparePartController {
/**
*
*
* @author hcy
* @author dabin
* @param pageParam
* @param param
* @return Object
*/
@GetMapping("/list")
public Object list(@Validated PageParam pageParam, SparePartParam param) {
Assert.notNull(param.getClientId(),"客户id不可为空");
Assert.notNull(param.getOrderType(),"订单类型不可为空");
PageResult<SparePartListVo> list = iSparePartService.list(pageParam, param);
return AjaxResult.success(list);
}
/**
*
*
* @author hcy
* @author dabin
* @param id ID
* @return Object
*/
@ -48,4 +51,14 @@ public class SparePartController {
SparePartDetailVo detail = iSparePartService.detail(id);
return AjaxResult.success(detail);
}
/**
*
* @author dabin
* @return Object
*/
@GetMapping("/mySparePart")
public Object mySparePart(@Validated PageParam pageParam) {
return AjaxResult.success(iSparePartService.mySparePart(pageParam));
}
}

View File

@ -104,6 +104,12 @@ public interface IMaintenanceOrderService {
*/
void confirmReceipt(MaintenanceOrderParam maintenanceOrderParam);
/**
*
* @param maintenanceOrderParam
*/
void postponeOrder(MaintenanceOrderParam maintenanceOrderParam);
/**
*
* @return OrderStatusCountVo

View File

@ -769,8 +769,6 @@ public class MaintenanceOrderServiceImpl implements IMaintenanceOrderService {
public void fillInReceipt(MaintenanceOrderParam maintenanceOrderParam) {
MaintenanceOrder maintenanceOrder = maintenanceOrderMapper.findMaintenanceOrderById(maintenanceOrderParam.getId());
Assert.notNull(maintenanceOrder, "数据不存在");
Assert.notNull(maintenanceOrderParam.getFamiliarFaultId(), "结论类型不可为空");
Assert.notNull(maintenanceOrderParam.getFamiliarFaultDescription(), "结论描述不可为空");
//只有维修中和填写回单状态才可以填写回单
if(maintenanceOrder.getOrderStatus() == MaintenanceOrderStatusEnum.MAINTENANCE_ING.getStatus() &&
@ -809,8 +807,6 @@ public class MaintenanceOrderServiceImpl implements IMaintenanceOrderService {
public void updateEquipmentModel(MaintenanceOrderParam maintenanceOrderParam) {
MaintenanceOrder maintenanceOrder = maintenanceOrderMapper.findMaintenanceOrderById(maintenanceOrderParam.getId());
Assert.notNull(maintenanceOrder, "数据不存在");
Assert.notNull(maintenanceOrderParam.getModelNo(), "模块编码不可为空");
Assert.notNull(maintenanceOrderParam.getBrand(), "品牌不可为空");
if(maintenanceOrder.getOrderStatus() == MaintenanceOrderStatusEnum.MAINTENANCE_ING.getStatus()){
EquipmentModel equipmentModel = equipmentModelMapper.findEquipmentModelByEquipmentId(maintenanceOrder.getEquipmentId());
@ -841,7 +837,6 @@ public class MaintenanceOrderServiceImpl implements IMaintenanceOrderService {
Assert.notNull(maintenanceOrder, "数据不存在");
if(maintenanceOrder.getOrderStatus() == MaintenanceOrderStatusEnum.MAINTENANCE_ING.getStatus()){
MaintenanceRepair maintenanceRepair = new MaintenanceRepair();
maintenanceRepair.setMaintenanceOrderId(maintenanceOrder.getId());
maintenanceRepair.setId(null);
@ -886,6 +881,21 @@ public class MaintenanceOrderServiceImpl implements IMaintenanceOrderService {
}
}
@Override
public void postponeOrder(MaintenanceOrderParam maintenanceOrderParam) {
MaintenanceOrder maintenanceOrder = maintenanceOrderMapper.findMaintenanceOrderById(maintenanceOrderParam.getId());
Assert.notNull(maintenanceOrder, "数据不存在");
if(maintenanceOrder.getOrderStatus() == MaintenanceOrderStatusEnum.MAINTENANCE_ING.getStatus()){
//设置暂缓原因和状态
maintenanceOrder.setPostponeCause(maintenanceOrderParam.getPostponeCause());
maintenanceOrder.setOrderStatus(MaintenanceOrderStatusEnum.POSTPONE.getStatus());
maintenanceOrderMapper.updateById(maintenanceOrder);
}else{
throw new OperateException("当前订单状态无法进行暂缓操作");
}
}
/**
*
*

View File

@ -0,0 +1,41 @@
package com.hcy.front.service.sparePartStockAudit;
import com.hcy.common.core.PageResult;
import com.hcy.front.validate.PageParam;
import com.hcy.front.validate.sparePartStockAudit.SparePartStockAuditParam;
import com.hcy.front.vo.sparePartStockAudit.SparePartStockAuditDetailVo;
import com.hcy.front.vo.sparePartStockAudit.SparePartStockAuditListVo;
/**
*
*/
public interface ISparePartStockAuditService {
/**
*
*
* @author hcy
* @param pageParam
* @param params
* @return PageResult<SparePartStockAuditVo>
*/
PageResult<SparePartStockAuditListVo> list(PageParam pageParam, SparePartStockAuditParam params);
/**
*
*
* @author hcy
* @param id ID
* @return SparePartStockAudit
*/
SparePartStockAuditDetailVo detail(Long id);
/**
*
*
* @author hcy
* @param sparePartStockAuditParam
*/
void add(SparePartStockAuditParam sparePartStockAuditParam);
}

View File

@ -0,0 +1,241 @@
package com.hcy.front.service.sparePartStockAudit.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hcy.common.core.PageResult;
import com.hcy.common.dto.SparePartStockAuditDto;
import com.hcy.common.dto.order.OrderSparePart;
import com.hcy.common.entity.SparePartAudit.SparePartAudit;
import com.hcy.common.entity.client.Client;
import com.hcy.common.entity.client.ClientContacts;
import com.hcy.common.entity.order.MaintenanceOrder;
import com.hcy.common.entity.order.RepairOrder;
import com.hcy.common.entity.sparePart.SparePart;
import com.hcy.common.entity.sparePartStockAudit.SparePartStockAudit;
import com.hcy.common.entity.system.SystemAuthAdmin;
import com.hcy.common.entity.user.User;
import com.hcy.common.entity.warehouse.Warehouse;
import com.hcy.common.enums.SparePartStockAuditEnum;
import com.hcy.common.enums.audit.AuditStateEnum;
import com.hcy.common.mapper.SparePartAudit.SparePartAuditMapper;
import com.hcy.common.mapper.client.ClientContactsMapper;
import com.hcy.common.mapper.client.ClientMapper;
import com.hcy.common.mapper.order.MaintenanceOrderMapper;
import com.hcy.common.mapper.order.OrderSparePartMapper;
import com.hcy.common.mapper.order.RepairOrderMapper;
import com.hcy.common.mapper.sparePart.SparePartMapper;
import com.hcy.common.mapper.sparePartStockAudit.SparePartStockAuditMapper;
import com.hcy.common.mapper.system.SystemAuthAdminMapper;
import com.hcy.common.mapper.user.UserMapper;
import com.hcy.common.mapper.warehouse.WarehouseMapper;
import com.hcy.common.utils.OrderUtil;
import com.hcy.common.utils.TimeUtil;
import com.hcy.front.FrontThreadLocal;
import com.hcy.front.service.order.impl.OrderOperateRecordServiceImpl;
import com.hcy.front.service.sparePartStockAudit.ISparePartStockAuditService;
import com.hcy.front.validate.PageParam;
import com.hcy.front.validate.sparePartStockAudit.SparePartStockAuditParam;
import com.hcy.front.vo.order.OrderSparePartListVo;
import com.hcy.front.vo.sparePartStockAudit.SparePartStockAuditDetailVo;
import com.hcy.front.vo.sparePartStockAudit.SparePartStockAuditListVo;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
@Service
public class SparePartStockAuditServiceImpl implements ISparePartStockAuditService {
@Resource
SparePartStockAuditMapper sparePartStockAuditMapper;
@Resource
SparePartMapper sparePartMapper;
@Resource
WarehouseMapper warehouseMapper;
@Resource
SparePartAuditMapper sparePartAuditMapper;
@Resource
MaintenanceOrderMapper maintenanceOrderMapper;
@Resource
RepairOrderMapper repairOrderMapper;
@Resource
UserMapper userMapper;
@Resource
OrderSparePartMapper orderSparePartMapper;
@Resource
SystemAuthAdminMapper systemAuthAdminMapper;
@Resource
OrderOperateRecordServiceImpl orderOperateRecordService;
@Resource
ClientMapper clientMapper;
@Resource
ClientContactsMapper clientContactsMapper;
/**
*
*
* @param pageParam
* @param params
* @return PageResult<SparePartStockAuditListVo>
* @author hcy
*/
@Override
public PageResult<SparePartStockAuditListVo> list(PageParam pageParam, SparePartStockAuditParam params) {
Integer page = pageParam.getPageNo();
Integer limit = pageParam.getPageSize();
SparePartStockAuditDto sparePartStockAuditDto = new SparePartStockAuditDto();
BeanUtils.copyProperties(params, sparePartStockAuditDto);
//领用时间范围,配送方式查询
IPage<SparePartStockAuditDto> iPage = sparePartStockAuditMapper.page(new Page<>(page, limit), sparePartStockAuditDto);
List<SparePartStockAuditListVo> list = new ArrayList<>();
for (SparePartStockAuditDto item : iPage.getRecords()) {
SparePartStockAuditListVo vo = new SparePartStockAuditListVo();
BeanUtils.copyProperties(item, vo);
vo.setSupplierPhone(item.getSupplier() + "/" + item.getPhone()); //供应商/电话
if (item.getOrderType() != null) {
User user = userMapper.selectById(item.getCreatorId());
if(user != null){
vo.setCreator(user.getNickname());
item.setConsignee(user.getNickname());
vo.setConsignerPhone(user.getNickname() + "/" + item.getPhone());
vo.setRecipientAndPhone(user.getNickname() + "/" + item.getPhone()); //领料员工/联系电话
}
} else {
SystemAuthAdmin systemAuthAdmin = systemAuthAdminMapper.findSystemAuthAdminById(item.getCreatorId());
if (systemAuthAdmin != null) {
vo.setCreator(systemAuthAdmin.getNickname());
item.setConsignee(systemAuthAdmin.getNickname());
vo.setConsignerPhone(systemAuthAdmin.getNickname() + "/" + item.getPhone());
vo.setRecipientAndPhone(systemAuthAdmin.getNickname() + "/" + item.getPhone()); //领料员工/联系电话
}
}
//设置仓库名称
if (AuditStateEnum.ALLOT.getStatus() == item.getReceiptType()) {
// 调入仓库名
Warehouse importWarehouseName = warehouseMapper.findWarehouseById(item.getImportWarehouse());
if (importWarehouseName != null) {
vo.setImportWarehouseName(importWarehouseName.getWarehouseName());
}
// 调出仓库名
Warehouse exportWarehouseName = warehouseMapper.findWarehouseById(item.getExportWarehouse());
if (exportWarehouseName != null) {
vo.setExportWarehouseName(exportWarehouseName.getWarehouseName());
}
} else {
Long warehouseId;
if (item.getImportWarehouse() != null) {
warehouseId = item.getImportWarehouse();
} else {
warehouseId = item.getExportWarehouse();
}
Warehouse warehouse = warehouseMapper.findWarehouseById(warehouseId);
if (warehouse != null) {
vo.setWarehouseName(warehouse.getWarehouseName());
}
}
// 获取客户名称
SystemAuthAdmin authAdmin = systemAuthAdminMapper.selectOne(new LambdaQueryWrapper<SystemAuthAdmin>()
.eq(SystemAuthAdmin::getId, item.getCreatorId()));
if(authAdmin != null){
ClientContacts clientContacts = clientContactsMapper.selectOne(new LambdaQueryWrapper<ClientContacts>()
.eq(ClientContacts::getAdminId, authAdmin.getId()));
if(clientContacts != null){
Client client = clientMapper.selectOne(new LambdaQueryWrapper<Client>()
.eq(Client::getId, clientContacts.getClientId()));
if(client != null){
vo.setClientName(client.getClientName());
}
}
}
list.add(vo);
}
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
}
/**
*
*
* @param id
* @return SparePartStockAudit
* @author hcy
*/
@Override
public SparePartStockAuditDetailVo detail(Long id) {
SparePartStockAudit model = sparePartStockAuditMapper.findSparePartStockAuditById(id);
Assert.notNull(model, "数据不存在");
SparePartStockAuditDetailVo vo = new SparePartStockAuditDetailVo();
BeanUtils.copyProperties(model, vo);
return vo;
}
/**
*
*
* @param sparePartStockAuditParam
* @author hcy
*/
@Override
@Transactional
public void add(SparePartStockAuditParam sparePartStockAuditParam) {
SparePartStockAudit model = new SparePartStockAudit();
BeanUtils.copyProperties(sparePartStockAuditParam, model);
SparePartStockAudit lastSparePartStockAudit = sparePartStockAuditMapper.findLastSparePartStockAuditByTime(TimeUtil.getCurrentTimeYYYYMMDD());
model.setReceiptNumber(OrderUtil.getOrderNo(lastSparePartStockAudit == null ? "" : lastSparePartStockAudit.getReceiptNumber())); // 单据编号
//判断当前订单类型设置对应出入库仓库id
if(sparePartStockAuditParam.getReceiptType() == AuditStateEnum.IN_WAREHOUSE.getStatus()){
model.setImportWarehouse(sparePartStockAuditParam.getWarehouseId());
}else if(sparePartStockAuditParam.getReceiptType() == AuditStateEnum.OUT_WAREHOUSE.getStatus()){
model.setExportWarehouse(sparePartStockAuditParam.getWarehouseId());
}
// 获取当前的用户
model.setCreatorId(FrontThreadLocal.getUserId());
sparePartStockAuditMapper.insert(model);
List<SparePartAudit> sparePartAuditList = sparePartStockAuditParam.getSparePartAuditList();
for (SparePartAudit item : sparePartAuditList) {
SparePart sparePart = sparePartMapper.findSparePartById(item.getId());
SparePartAudit sparePartAudit = new SparePartAudit();
BeanUtils.copyProperties(sparePart, sparePartAudit);
sparePartAudit.setId(null);
sparePartAudit.setStockAuditId(model.getId());
sparePartAudit.setSparePartsId(sparePart.getId());
sparePartAudit.setCount(item.getCount());
sparePartAuditMapper.insert(sparePartAudit);//插入备件审核信息
}
}
}

View File

@ -32,4 +32,12 @@ public interface ISparePartService {
* @return SparePart
*/
SparePartDetailVo detail(Integer id);
/**
*
* @author hcy
* @return SparePart
*/
PageResult<SparePartListVo> mySparePart(PageParam pageParam);
}

View File

@ -72,8 +72,6 @@ public class SparePartServiceImpl implements ISparePartService {
Integer page = pageParam.getPageNo();
Integer limit = pageParam.getPageSize();
Assert.notNull(param.getClientId(),"客户id不可为空");
Assert.notNull(param.getOrderType(),"订单类型不可为空");
SparePartDto sparePartDto = new SparePartDto();
BeanUtils.copyProperties(param,sparePartDto);
@ -145,4 +143,27 @@ public class SparePartServiceImpl implements ISparePartService {
vo.setWarehouseName(warehouse.getWarehouseName());
return vo;
}
@Override
public PageResult<SparePartListVo> mySparePart(PageParam pageParam) {
Integer page = pageParam.getPageNo();
Integer limit = pageParam.getPageSize();
//获取用户信息
User user = userMapper.findUserById(FrontThreadLocal.getUserId().longValue());
LambdaQueryWrapper<SparePart> queryWrapper = new LambdaQueryWrapper<SparePart>()
.eq(SparePart::getIsDelete, GlobalConstant.NOT_DELETE)
.eq(SparePart::getWarehouseId,user.getWarehouseId());
Page<SparePart> iPage = sparePartMapper.selectPage(new Page<>(page, limit), queryWrapper);
List<SparePartListVo> sparePartListVoList = new ArrayList<>();
for (SparePart item : iPage.getRecords()) {
SparePartListVo sparePartListVo = new SparePartListVo();
BeanUtils.copyProperties(item, sparePartListVo);
sparePartListVoList.add(sparePartListVo);
}
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), sparePartListVoList);
}
}

View File

@ -77,6 +77,8 @@ public class MaintenanceOrderParam implements Serializable {
private String refuseMaintenanceCause;
private String postponeCause; //暂缓原因
@Length(max = 250, message = "remark参数不能超出250个字符", groups = {create.class, update.class})
private String remark;

View File

@ -0,0 +1,104 @@
package com.hcy.front.validate.sparePartStockAudit;
import com.hcy.common.entity.SparePartAudit.SparePartAudit;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.DecimalMin;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
*
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SparePartStockAuditParam implements Serializable {
private static final long serialVersionUID = 1L;
public interface create{}
public interface update{}
public interface delete{}
private Long id;
private String receiptNumber;
private Integer receiptType;
//@NotNull(message = "warehouseId参数缺失", groups = {create.class, update.class})
@DecimalMin(value = "0", message = "warehouseId参数值不能少于0", groups = {create.class, update.class})
private Long warehouseId;
//@NotNull(message = "importWarehouse参数缺失", groups = {create.class, update.class})
@DecimalMin(value = "0", message = "importWarehouse参数值不能少于0", groups = {create.class, update.class})
private Long importWarehouse;
//@NotNull(message = "exportWarehouse参数缺失", groups = {create.class, update.class})
@DecimalMin(value = "0", message = "exportWarehouse参数值不能少于0", groups = {create.class, update.class})
private Long exportWarehouse;
//@NotNull(message = "supplier参数缺失", groups = {create.class, update.class})
@Length(max = 32, message = "supplier参数不能超出32个字符", groups = {create.class, update.class})
private String supplier;
// @NotNull(message = "handlingTime参数缺失", groups = {create.class, update.class})
private Date handlingTime;
//@NotNull(message = "consignee参数缺失", groups = {create.class, update.class})
@Length(max = 255, message = "consignee参数不能超出255个字符", groups = {create.class, update.class})
private String consignee;
//@NotNull(message = "auditState参数缺失", groups = {create.class, update.class})
@DecimalMin(value = "0", message = "auditState参数值不能少于0", groups = {create.class, update.class})
private Integer auditState;
//@NotNull(message = "auditResult参数缺失", groups = {create.class, update.class})
@DecimalMin(value = "0", message = "auditResult参数值不能少于0", groups = {create.class, update.class})
private Integer auditResult;
private Date auditTime;
//@Length(max = 255, message = "auditIdea参数不能超出255个字符", groups = {create.class, update.class})
private String auditIdea;
//@Length(max = 32, message = "phone参数不能超出32个字符", groups = {create.class, update.class})
private String phone;
//@Length(max = 255, message = "remark参数不能超出255个字符", groups = {create.class, update.class})
private String remark;
private String sparePartAuditId; // 备件审核id
private List<SparePartAudit> sparePartAuditList; //待入库的备件
private Integer outInWarehouseType; //出入库类别0=采购入库1=库存调拨2=员工领料3=销售出库)
private String workOrderId; //工单号
private String orderId; //订单编号
private String shippingAddress; //收货地址
private String consigner; //发货人
private String consignerPhone; //发货人联系电话
private String shipAddress; //发货地址
private String logisticsCompany; //物流公司
private String trackingNumber; //物流编号
private Integer deliveryMethod; //配送方式0=物流快递1=上门取件2=送货上门)
private BigDecimal salesPrice; //销售价
private String recipient; //领用员工
private String recipientPhone; //领用员工联系电话
private Integer recipientNumber; //领用数量
private Integer purchaseStatus; //配件领用状态0=待审核1=未通过2=待管理员审核3=待发货4=待收货5=已完成)
private String purchaseIdea; //采购意见
private String orderType; // 0-检修工单 1-维修工单
private String workOrderNo; //工单号
private Integer queryType; // 0-待审核 1-待发货 2-待收货 3-已完成
private String createTimeStart; //创建时间
private String createTimeEnd; //创建时间
private String responsiblePerson; // 经办人
}

View File

@ -1,5 +1,7 @@
package com.hcy.front.vo.sparePartStockAudit;
import com.hcy.admin.vo.SparePartAudit.SparePartAuditListVo;
import com.hcy.admin.vo.order.OrderSparePartListVo;
import lombok.Data;
import java.io.Serializable;
@ -54,6 +56,11 @@ public class SparePartStockAuditDetailVo implements Serializable {
private Integer orderType; // 0-检修工单 1-维修工单
private String workOrderNo; //工单号
private List<SparePartAuditListVo> sparePartAuditList; //待入库的备件
private List<OrderSparePartListVo> orderSparePartListVoList; //订单配件
private String recipientAndPhone; //领用员工/联系电话
private String creator; // 创建人
private Long auditorId; // 审核人id
private String responsiblePerson; // 经办人
}

View File

@ -1,10 +1,13 @@
package com.hcy.front.vo.sparePartStockAudit;
import com.hcy.admin.vo.SparePartAudit.SparePartAuditListVo;
import com.hcy.admin.vo.order.OrderSparePartListVo;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* SparePartStockAuditVo
@ -21,7 +24,7 @@ public class SparePartStockAuditListVo implements Serializable {
private Long importWarehouse; // 调入仓库
private Long exportWarehouse; // 调出仓库
private String supplier; // 供应商
private String responsiblePerson; // 经办人
private String consignee; // 收货单位(人员)
private Integer auditState; // 审核状态0=未审核1=已审核2=已取消)
private Integer auditResult; // 审核结果0=已通过1=未通过)
@ -36,7 +39,8 @@ public class SparePartStockAuditListVo implements Serializable {
private Integer outInWarehouseType; // 出入库类别0=采购入库1=库存调拨2=员工领料3=销售出库)
private String workOrderId; //工单号
private String orderId; //订单编号
private Long orderId; //订单编号
private Integer orderType; // 0-检修工单 1-维修工单
private String shippingAddress; //收货地址
private String consigner; //发货人
private String consignerPhone; //发货人联系电话
@ -51,7 +55,12 @@ public class SparePartStockAuditListVo implements Serializable {
private Integer purchaseStatus; //配件领用状态0=待审核1=未通过2=待管理员审核3=待发货4=待收货5=已完成)
private String workOrderNo; //工单号
private List<SparePartAuditListVo> sparePartAuditList; //待入库的备件
private List<OrderSparePartListVo> orderSparePartListVoList; //订单配件
private String recipientAndPhone; //领用员工/联系电话
private String supplierPhone; // 供应商/电话
private String creator; // 创建人
private Long auditorId; // 审核人id
private String responsiblePerson; // 经办人
private String clientName; // 客户名称
}