Browse Source

[feat]

售后维护设备出库前端页面:新增确认验收按钮和其对应的方法
新增 收货确认验收前端页面。实现现如果有多个销售单号就显示多个,下面的物料分为成品和其他类型,成品的物料分开展示,设置本次出货数为1,每个设备只能签收一次,如果已收货数等于已验收数,则显示已验收,不可编辑;其他物料不必分开展示,但是也要如果已收货数等于已验收数,则显示已验收,不可编辑;如果已收货数为0的数据,显示不可验收
新增 售后确认验收Vo类
售后维护设备出库Controller,新增确认验收后端接口;新增 修改保存确认验收后端接口;新增 确认验收 物料信息详情后端接口
售后维护设备出库iml层:
售后确认验收方法实现:先设置 没有出货设备Id的是否全部验收为0,有出货设备Id的是否全部验收为0;先遍历前端传入的每个数据,如果已经验收数等于已经出货数。 根据已收货数来决定填写本次验收数;并且首先要 过滤掉每个已收货数为0的数据,因为其不可验收;还要过滤掉已收货数等于已验收数的数据,因为其已验收;还要判断已经过滤完的数据是否全部填写本次验收数;然后分别处理有出货设备id的数据和没有出货设备id的数据。分别进行判断如果本次出货数等于已验收数,就设置全部验收。如果有出货设备id的数据和没有出货设备id的数据都全部验收,则设置出货通知单全部验收,否则是部分验收
售后确认验收详情方法实现:把带出货设备id的成品出货设备进行拆分展示,根据设备的状态设置已验收数和已收货数
出货设备实体类新增 isConfirmCheckFlag字段,并且mapper.xml层的所有方法加上 isConfirmCheckFlag字段,
去掉销售出货通知旧版客户验收按钮和方法
销售出货通知iml层新增 根据出库单号查询销售出货通知单方法;修改保存确认收货方法:实现 过滤掉每个已收货数等于本次出货数的数据;对有出货设备id的数据和没有出货设备id的数据都进行判空操作
dev
liuxiaoxu 2 weeks ago
parent
commit
3c1ad6eabe
  1. 72
      ruoyi-admin/src/main/java/com/ruoyi/aftersales/controller/AftersalesOutOrderController.java
  2. 12
      ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AfterSalesShippingDevice.java
  3. 19
      ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/vo/ConfirmCheckDetailVo.java
  4. 16
      ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAftersalesOutOrderService.java
  5. 313
      ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesOutOrderServiceImpl.java
  6. 4
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesShippingInformService.java
  7. 26
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformServiceImpl.java
  8. 16
      ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml
  9. 306
      ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/aftersalesConfirmCheck.html
  10. 20
      ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/aftersalesOutOrder.html
  11. 3
      ruoyi-admin/src/main/resources/templates/system/salesShippingInform/confirmReceiving.html
  12. 11
      ruoyi-admin/src/main/resources/templates/system/salesShippingInform/salesShippingInform.html

72
ruoyi-admin/src/main/java/com/ruoyi/aftersales/controller/AftersalesOutOrderController.java

@ -2,11 +2,20 @@ package com.ruoyi.aftersales.controller;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.ruoyi.aftersales.domain.AftersalesOutOrderDetail;
import com.ruoyi.aftersales.domain.vo.ConfirmCheckDetailVo;
import com.ruoyi.aftersales.domain.vo.SelectShippingDeviceVO;
import com.ruoyi.aftersales.service.IAftersalesOutOrderDetailService;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysSalesOrder;
import com.ruoyi.system.domain.SysSalesShippingInform;
import com.ruoyi.system.domain.Vo.ConfirmReceivingDetailVo;
import com.ruoyi.system.service.ISysSalesOrderService;
import com.ruoyi.system.service.ISysSalesShippingInformService;
import lombok.SneakyThrows;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
@ -40,6 +49,12 @@ public class AftersalesOutOrderController extends BaseController
@Autowired
private IAftersalesOutOrderDetailService aftersalesOutOrderDetailService;
@Autowired
private ISysSalesShippingInformService shippingInformService;
@Autowired
private ISysSalesOrderService sysSalesOrderService;
@RequiresPermissions("aftersales:aftersalesOutOrder:view")
@GetMapping()
public String aftersalesOutOrder()
@ -397,4 +412,61 @@ public String addShippingDevicesOne(@RequestParam("outOrderDetailId") Long outOr
}
/**
* 确认验收
*/
@GetMapping("/aftersalesConfirmCheck/{outOrderId}")
public String aftersalesConfirmCheck(@PathVariable("outOrderId") Long outOrderId, ModelMap mmap)
{
AftersalesOutOrder aftersalesOutOrder = aftersalesOutOrderService.selectAftersalesOutOrderById(outOrderId);
String outOrderCode = aftersalesOutOrder.getOutOrderCode();
SysSalesShippingInform sysSalesShippingInform = shippingInformService.selectSysSalesShippingInformByCode(outOrderCode);
List<SysSalesOrder> sysSalesOrders = new ArrayList<>();
String salesOrderCode = sysSalesShippingInform.getSalesOrderCode();
List<String> salesOrderCodes = new ArrayList<>();
if (StringUtils.isNotEmpty(salesOrderCode)){
String[] splitSalesOrderCode = salesOrderCode.split(",");
salesOrderCodes = Arrays.asList(splitSalesOrderCode);
}
sysSalesOrders = sysSalesOrderService.selectSysSalesOrderListByCodeList(salesOrderCodes);
mmap.put("sysSalesOrders", sysSalesOrders);
mmap.put("sysSalesShippingInform", sysSalesShippingInform);
return prefix + "/aftersalesConfirmCheck";
}
/**
* 修改保存确认验收
*/
@RequiresPermissions("aftersales:aftersalesOutOrder:aftersalesConfirmCheck")
@Log(title = "销售确认收货", businessType = BusinessType.UPDATE)
@PostMapping("/aftersalesConfirmCheck")
@ResponseBody
public AjaxResult aftersalesConfirmCheckSave(@RequestBody SysSalesShippingInform sysSalesShippingInform)
{
return toAjax(aftersalesOutOrderService.updateAftersalesConfirmCheck(sysSalesShippingInform));
}
/**
* 确认验收 物料信息详情
*/
@PostMapping("/aftersalesConfirmCheckDetailList")
@ResponseBody
public TableDataInfo aftersalesConfirmCheckDetailList(SysSalesShippingInform sysSalesShippingInform)
{
startPage();
List<ConfirmCheckDetailVo> list = aftersalesOutOrderService.aftersalesConfirmCheckDetailList(sysSalesShippingInform);
return getDataTable(list);
}
}

12
ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AfterSalesShippingDevice.java

@ -170,6 +170,9 @@ public class AfterSalesShippingDevice extends BaseEntity
private String isConfirmReceivingFlag;
/** 是否确认验收 (0代表是 1代表否) 售后确认验收时使用 */
private String isConfirmCheckFlag;
//生产开始时间
private Date startMakeTime;
@ -544,6 +547,14 @@ public class AfterSalesShippingDevice extends BaseEntity
this.isConfirmReceivingFlag = isConfirmReceivingFlag;
}
public String getIsConfirmCheckFlag() {
return isConfirmCheckFlag;
}
public void setIsConfirmCheckFlag(String isConfirmCheckFlag) {
this.isConfirmCheckFlag = isConfirmCheckFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -588,6 +599,7 @@ public class AfterSalesShippingDevice extends BaseEntity
.append("addShippingDeviceFlag",getAddShippingDeviceFlag())
.append("outOrderCode",getOutOrderCode())
.append("isConfirmReceivingFlag",getIsConfirmReceivingFlag())
.append("isConfirmCheckFlag",getIsConfirmCheckFlag())
.toString();
}
}

19
ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/vo/ConfirmCheckDetailVo.java

@ -0,0 +1,19 @@
package com.ruoyi.aftersales.domain.vo;
import com.ruoyi.system.domain.SysSalesShippingInformDetail;
import lombok.Data;
/**
* 收货确认验收Vo类
* */
@Data
public class ConfirmCheckDetailVo extends SysSalesShippingInformDetail {
/** 出货设备id */
private String shippingDeviceId;
/** SN号 */
private String snCode;
}

16
ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAftersalesOutOrderService.java

@ -3,7 +3,9 @@ package com.ruoyi.aftersales.service;
import java.util.List;
import com.ruoyi.aftersales.domain.AftersalesOutOrder;
import com.ruoyi.aftersales.domain.AftersalesOutOrderDetail;
import com.ruoyi.aftersales.domain.vo.ConfirmCheckDetailVo;
import com.ruoyi.aftersales.domain.vo.SelectShippingDeviceVO;
import com.ruoyi.system.domain.SysSalesShippingInform;
/**
* 售后维护设备出库Service接口
@ -135,4 +137,18 @@ public interface IAftersalesOutOrderService
* @return
*/
List<SelectShippingDeviceVO> showAddShippingDevicesTwo(AftersalesOutOrder aftersalesOutOrder);
/**
* 售后确认验收
* @param sysSalesShippingInform
* @return
*/
int updateAftersalesConfirmCheck(SysSalesShippingInform sysSalesShippingInform);
/**
* 售后确认验收详情
* @param sysSalesShippingInform
* @return
*/
List<ConfirmCheckDetailVo> aftersalesConfirmCheckDetailList(SysSalesShippingInform sysSalesShippingInform);
}

313
ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesOutOrderServiceImpl.java

@ -5,6 +5,7 @@ import java.util.stream.Collectors;
import com.ruoyi.aftersales.domain.AfterSalesShippingDevice;
import com.ruoyi.aftersales.domain.AftersalesOutOrderDetail;
import com.ruoyi.aftersales.domain.vo.ConfirmCheckDetailVo;
import com.ruoyi.aftersales.domain.vo.SelectShippingDeviceVO;
import com.ruoyi.aftersales.mapper.AfterSalesShippingDeviceMapper;
import com.ruoyi.aftersales.mapper.AftersalesOutOrderDetailMapper;
@ -12,10 +13,17 @@ import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysSalesOrder;
import com.ruoyi.system.domain.SysSalesShippingInform;
import com.ruoyi.system.domain.SysSalesShippingInformDetail;
import com.ruoyi.system.domain.Vo.ConfirmReceivingDetailVo;
import com.ruoyi.system.mapper.SysSalesOrderMapper;
import com.ruoyi.system.mapper.SysSalesShippingInformDetailMapper;
import com.ruoyi.system.mapper.SysSalesShippingInformMapper;
import com.ruoyi.warehouse.domain.WarehouseOutOrder;
import com.ruoyi.warehouse.mapper.WarehouseOutOrderMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.aftersales.mapper.AftersalesOutOrderMapper;
@ -25,12 +33,15 @@ import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import static com.ruoyi.common.config.datasource.DynamicDataSourceContextHolder.log;
/**
* 售后维护设备出库Service业务层处理
*
* @author 刘晓旭
* @date 2024-11-06
*/
@Slf4j
@Service
public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService
{
@ -49,6 +60,12 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService
@Autowired
private SysSalesShippingInformMapper shippingInformMapper;
@Autowired
private SysSalesShippingInformDetailMapper shippingInformDetailMapper;
@Autowired
private SysSalesOrderMapper sysSalesOrderMapper;
/**
* 查询售后维护设备出库
*
@ -560,4 +577,300 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService
}
}
/**
* 售后确认验收
* @param sysSalesShippingInform
* @return
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int updateAftersalesConfirmCheck(SysSalesShippingInform sysSalesShippingInform) {
String loginName = ShiroUtils.getLoginName();
//从数据库中查
SysSalesShippingInform oldsSalesShippingInform = shippingInformMapper.selectSysSalesShippingInformByCode(sysSalesShippingInform.getOutOrderCode());
//没有出货设备Id的是否全部验收
Integer allWithoutCheckFlag = 0;
//有出货设备Id的是否全部验收
Integer allWithCheckFlag = 0;
List<SysSalesShippingInformDetail> shippingInformDetailList = sysSalesShippingInform.getShippingInformDetailList();
List<SysSalesShippingInformDetail> tempDetails = shippingInformDetailList.stream()
.map(detail -> shippingInformDetailMapper.selectSysSalesShippingInformDetailById(detail.getShippingInformDetailId()))
.collect(Collectors.toList());
// 防止已经完成验收,但是从前端传不过来数据,导致状态没有更新
for (int i = 0; i < shippingInformDetailList.size(); i++) {
SysSalesShippingInformDetail detail = shippingInformDetailList.get(i);
SysSalesShippingInformDetail tempDetail = tempDetails.get(i);
if (StringUtils.isNotEmpty(detail.getShippingDeviceId())) {
if (Objects.equals(tempDetail.getHasCheckNum(), tempDetail.getThisShippingNum())) {
allWithCheckFlag = 1;
}
} else {
if (Objects.equals(tempDetail.getHasCheckNum(), tempDetail.getThisShippingNum())) {
allWithoutCheckFlag = 1;
}
}
}
//过滤掉每个已收货数为0的数据,因为其不可验收
shippingInformDetailList = shippingInformDetailList.stream()
.filter(item -> item.getHasReceivingNum() != 0)
.collect(Collectors.toList());
//还要过滤掉已收货数等于已验收数的数据,因为其已验收
shippingInformDetailList = shippingInformDetailList.stream()
.filter(item -> !Objects.equals(item.getHasReceivingNum(), item.getHasCheckNum()))
.collect(Collectors.toList());
// // 合并过滤操作
// shippingInformDetailList = shippingInformDetailList.stream()
// .filter(item -> item.getHasReceivingNum() != 0 && !Objects.equals(item.getHasReceivingNum(), item.getHasCheckNum()))
// .collect(Collectors.toList());
boolean anyNullThisCheckNum = shippingInformDetailList.stream().anyMatch(item -> item.getThisCheckNum() == null);
if (anyNullThisCheckNum){
throw new BusinessException("请填写每个本次验收数");
}
// 分组:有 shippingDeviceId 和没有 shippingDeviceId
Map<Boolean, List<SysSalesShippingInformDetail>> groupedDetails = shippingInformDetailList.stream()
.collect(Collectors.partitioningBy(detail -> detail.getShippingDeviceId() != null));
List<SysSalesShippingInformDetail> withShippingDeviceIdList = groupedDetails.getOrDefault(true, new ArrayList<>());
List<SysSalesShippingInformDetail> withoutShippingDeviceIdList = groupedDetails.getOrDefault(false, new ArrayList<>());
if (!CollectionUtils.isEmpty(withoutShippingDeviceIdList)){
// 处理没有出货设备ID的数据
allWithoutCheckFlag = processWithoutShippingDeviceId(withoutShippingDeviceIdList, allWithoutCheckFlag);
}
if (!CollectionUtils.isEmpty(withShippingDeviceIdList)){
// 处理有出货设备ID的数据
allWithCheckFlag = processWithShippingDeviceId(withShippingDeviceIdList, allWithCheckFlag);
}
//更新收货维护设备出库单数据
AftersalesOutOrder aftersalesOutOrder = new AftersalesOutOrder();
aftersalesOutOrder.setOutOrderCode(sysSalesShippingInform.getOutOrderCode());
String salesOrderCode = oldsSalesShippingInform.getSalesOrderCode();
List<String> salesOrderCodes = new ArrayList<>();
if (StringUtils.isNotEmpty(salesOrderCode)){
String[] splitSalesOrderCode = salesOrderCode.split(",");
salesOrderCodes = Arrays.asList(splitSalesOrderCode);
}
// List<SysSalesOrder> sysSalesOrders = sysSalesOrderMapper.selectSysSalesOrderListByCodeList(salesOrderCodes);
//设置为全部验收
if (allWithoutCheckFlag == 1 && allWithCheckFlag == 1){
aftersalesOutOrder.setWarehouseOutStatus("12");
sysSalesShippingInform.setWarehouseOutStatus("12");
// sysSalesOrders.forEach(item->{
// item.setDeliveryStatus("8");//全部验收
// });
}else {
//设置为部分验收
aftersalesOutOrder.setWarehouseOutStatus("11");
// sysSalesOrders.forEach(item->{
// item.setDeliveryStatus("7");//部分验收
// });
}
// for (SysSalesOrder sysSalesOrder : sysSalesOrders) {
// sysSalesOrder.setUpdateTime(new Date());
// sysSalesOrder.setUpdateBy(loginName);
// int updateSysSalesOrderResult = sysSalesOrderMapper.updateSysSalesOrderBySalesOrderCode(sysSalesOrder);
// if (updateSysSalesOrderResult <= 0){
// throw new BusinessException("更新销售订单数据失败");
// }
// }
sysSalesShippingInform.setSalesOrderCode(oldsSalesShippingInform.getSalesOrderCode());
int updateShippingInformResult = shippingInformMapper.updateSysSalesShippingInformByOutOrderCode(sysSalesShippingInform);
if (updateShippingInformResult <= 0){
throw new BusinessException("更新销售出库单数据失败");
}
aftersalesOutOrder.setUpdateBy(loginName);
aftersalesOutOrder.setUpdateTime(new Date());
int updateAftersalesOutOrderResult = aftersalesOutOrderMapper.updateAftersalesOutOrderByOutOrderCode(aftersalesOutOrder);
if (updateAftersalesOutOrderResult <= 0){
throw new BusinessException("更新售后出库单数据失败");
}
return updateAftersalesOutOrderResult;
}
private Integer processWithoutShippingDeviceId(List<SysSalesShippingInformDetail> withoutShippingDeviceIdList,Integer allWithoutCheckFlag) {
for (SysSalesShippingInformDetail sysSalesShippingInformDetail : withoutShippingDeviceIdList) {
Long shippingInformDetailId = sysSalesShippingInformDetail.getShippingInformDetailId();
SysSalesShippingInformDetail tempShippingInformDetail = shippingInformDetailMapper.selectSysSalesShippingInformDetailById(shippingInformDetailId);
if (tempShippingInformDetail.getHasCheckNum() == null || tempShippingInformDetail.getHasCheckNum() == 0) {
sysSalesShippingInformDetail.setHasCheckNum(sysSalesShippingInformDetail.getThisCheckNum());
} else {
sysSalesShippingInformDetail.setHasCheckNum(tempShippingInformDetail.getHasCheckNum() + sysSalesShippingInformDetail.getThisCheckNum());
}
if (sysSalesShippingInformDetail.getHasCheckNum() > sysSalesShippingInformDetail.getHasReceivingNum()) {
throw new BusinessException("已验收数和本次验收数之和不能大于已收货数");
}
sysSalesShippingInformDetail.setThisCheckNum(null);
if (Objects.equals(tempShippingInformDetail.getThisShippingNum(), sysSalesShippingInformDetail.getHasCheckNum())){
allWithoutCheckFlag = 1;
}
int updateShippingInformDetailResult = shippingInformDetailMapper.updateSysSalesShippingInformDetail(sysSalesShippingInformDetail);
if (updateShippingInformDetailResult <= 0) {
throw new BusinessException("更新销售出货通知单详情数据失败");
}
}
return allWithoutCheckFlag;
}
private Integer processWithShippingDeviceId(List<SysSalesShippingInformDetail> withShippingDeviceIdList,Integer allWithCheckFlag) {
String loginName = ShiroUtils.getLoginName();
// List<SysSalesShippingInformDetail> filterShippingDeviceIdList = withShippingDeviceIdList.stream()
// .filter(item -> item.getHasCheckNum() != 1)
// .collect(Collectors.toList());
// 判断是否有收货数量大于1,因为收货数量要么为0要么为1
boolean anyThisCheckNum = withShippingDeviceIdList.stream().anyMatch(item -> item.getThisCheckNum() > 1);
if (anyThisCheckNum){
throw new BusinessException("本次验收数量只能为0或1");
}
for (SysSalesShippingInformDetail sysSalesShippingInformDetail : withShippingDeviceIdList) {
String shippingDeviceId = sysSalesShippingInformDetail.getShippingDeviceId();
AfterSalesShippingDevice afterSalesShippingDevice = afterSalesShippingDeviceMapper.selectAfterSalesShippingDeviceByShippingDeviceId(shippingDeviceId);
if (sysSalesShippingInformDetail.getThisCheckNum() == 1){
afterSalesShippingDevice.setIsConfirmCheckFlag("0"); //设置已经验收
}
afterSalesShippingDevice.setUpdateBy(loginName);
afterSalesShippingDevice.setUpdateTime(new Date());
int updateShippingDeviceResult = afterSalesShippingDeviceMapper.updateAfterSalesShippingDevice(afterSalesShippingDevice);
if (updateShippingDeviceResult <= 0){
throw new BusinessException("更新出货设备数据失败");
}
}
Integer allCheckNum = withShippingDeviceIdList.stream()
.mapToInt(SysSalesShippingInformDetail::getThisCheckNum)
.sum();
SysSalesShippingInformDetail sysSalesShippingInformDetail = withShippingDeviceIdList.get(0);
Long shippingInformDetailId = sysSalesShippingInformDetail.getShippingInformDetailId();
SysSalesShippingInformDetail tempShippingInformDetail = shippingInformDetailMapper.selectSysSalesShippingInformDetailById(shippingInformDetailId);
if (tempShippingInformDetail.getHasCheckNum() == null) {
tempShippingInformDetail.setHasCheckNum(allCheckNum);
} else {
tempShippingInformDetail.setHasCheckNum(tempShippingInformDetail.getHasCheckNum() + allCheckNum);
}
if (Objects.equals(tempShippingInformDetail.getThisShippingNum(), tempShippingInformDetail.getHasCheckNum())){
allWithCheckFlag = 1;
}
int updateShippingInformDetailResult = shippingInformDetailMapper.updateSysSalesShippingInformDetail(tempShippingInformDetail);
if (updateShippingInformDetailResult <= 0) {
throw new BusinessException("更新销售出货通知单详情数据失败");
}
return allWithCheckFlag;
}
/**
* 售后确认验收详情
* @param sysSalesShippingInform
* @return
*/
@Override
public List<ConfirmCheckDetailVo> aftersalesConfirmCheckDetailList(SysSalesShippingInform sysSalesShippingInform) {
List<ConfirmCheckDetailVo> confirmCheckDetailVos = new ArrayList<>();
String outOrderCode = sysSalesShippingInform.getOutOrderCode();
List<SysSalesShippingInformDetail> sysSalesShippingInformDetails = shippingInformDetailMapper.selectSysSalesShippingInformDetailByCode(outOrderCode);
if (CollectionUtils.isEmpty(sysSalesShippingInformDetails)){
log.warn("确认收货物料详情为空,出库单号为:{}",outOrderCode);
}
for (SysSalesShippingInformDetail sysSalesShippingInformDetail : sysSalesShippingInformDetails) {
ConfirmCheckDetailVo confirmCheckDetailVo = new ConfirmCheckDetailVo();
BeanUtils.copyProperties(sysSalesShippingInformDetail,confirmCheckDetailVo);
confirmCheckDetailVos.add(confirmCheckDetailVo);
}
// 过滤 materialType 为 chcpsb 的设备
List<ConfirmCheckDetailVo> chcpsbDevices = confirmCheckDetailVos.stream()
.filter(item -> "chcpsb".equals(item.getMaterialType()))
.collect(Collectors.toList());
// 存储最终要保留的 chcpsb 设备
List<ConfirmCheckDetailVo> validChcpsbDevices = new ArrayList<>();
for (ConfirmCheckDetailVo chcpsbDevice : chcpsbDevices) {
String materialNo = chcpsbDevice.getMaterialNo();
AfterSalesShippingDevice afterSalesShippingDevice = new AfterSalesShippingDevice();
afterSalesShippingDevice.setMaterialNo(materialNo);
afterSalesShippingDevice.setOutOrderCode(outOrderCode);
List<AfterSalesShippingDevice> afterSalesShippingDevices = afterSalesShippingDeviceMapper.selectHasAddShippingDevice(afterSalesShippingDevice);
if (!CollectionUtils.isEmpty(afterSalesShippingDevices)) {
for (AfterSalesShippingDevice device : afterSalesShippingDevices) {
ConfirmCheckDetailVo detailVo = new ConfirmCheckDetailVo();
BeanUtils.copyProperties(chcpsbDevice, detailVo);
detailVo.setShippingDeviceId(device.getShippingDeviceId());
detailVo.setSnCode(device.getSnCode());
detailVo.setThisShippingNum(1);
detailVo.setHasOutOrderNum(1);
if ("0".equals(device.getIsConfirmReceivingFlag())){
detailVo.setHasReceivingNum(1);
}else {
detailVo.setHasReceivingNum(0);
}
if ("0".equals(device.getIsConfirmCheckFlag())){
detailVo.setHasCheckNum(1);
}else {
detailVo.setHasCheckNum(0);
}
validChcpsbDevices.add(detailVo);
}
}
}
// 从 ConfirmCheckDetailVos 中移除没有对应 AfterSalesShippingDevice 的 chcpsb 设备
confirmCheckDetailVos = confirmCheckDetailVos.stream()
.filter(item -> !"chcpsb".equals(item.getMaterialType()) || validChcpsbDevices.contains(item))
.collect(Collectors.toList());
// 添加有效的 chcpsb 设备
confirmCheckDetailVos.addAll(validChcpsbDevices);
return confirmCheckDetailVos;
}
}

4
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesShippingInformService.java

@ -161,4 +161,8 @@ public interface ISysSalesShippingInformService
List<ConfirmReceivingDetailVo> confirmReceivingDetailList(SysSalesShippingInform sysSalesShippingInform);
/**
* 根据出库单号查询销售出货通知单
* */
SysSalesShippingInform selectSysSalesShippingInformByCode(String outOrderCode);
}

26
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformServiceImpl.java

@ -112,6 +112,15 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor
return sysSalesShippingInformMapper.selectSysSalesShippingInformList(sysSalesShippingInform);
}
/**
* 根据出库单号查询销售出货通知单
* */
@Override
public SysSalesShippingInform selectSysSalesShippingInformByCode(String outOrderCode) {
return sysSalesShippingInformMapper.selectSysSalesShippingInformByCode(outOrderCode);
}
/**
* 新增销售出货通知
*
@ -389,6 +398,11 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor
List<SysSalesShippingInformDetail> shippingInformDetailList = sysSalesShippingInform.getShippingInformDetailList();
//过滤掉每个已收货数等于本次出货数的数据
shippingInformDetailList = shippingInformDetailList.stream()
.filter(item -> !Objects.equals(item.getThisShippingNum(), item.getHasReceivingNum()))
.collect(Collectors.toList());
boolean anyNullThisReceivingNum = shippingInformDetailList.stream().anyMatch(item -> item.getThisReceivingNum() == null);
if (anyNullThisReceivingNum){
throw new BusinessException("请填写每个本次收货数");
@ -401,11 +415,15 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor
List<SysSalesShippingInformDetail> withShippingDeviceIdList = groupedDetails.getOrDefault(true, new ArrayList<>());
List<SysSalesShippingInformDetail> withoutShippingDeviceIdList = groupedDetails.getOrDefault(false, new ArrayList<>());
// 处理没有出货设备ID的数据
processWithoutShippingDeviceId(withoutShippingDeviceIdList);
if (!CollectionUtils.isEmpty(withoutShippingDeviceIdList)){
// 处理没有出货设备ID的数据
processWithoutShippingDeviceId(withoutShippingDeviceIdList);
}
// 处理有出货设备ID的数据
processWithShippingDeviceId(withShippingDeviceIdList);
if (!CollectionUtils.isEmpty(withShippingDeviceIdList)){
// 处理有出货设备ID的数据
processWithShippingDeviceId(withShippingDeviceIdList);
}
//更新收货维护设备出库单数据
AftersalesOutOrder aftersalesOutOrder = new AftersalesOutOrder();

16
ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml

@ -46,6 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="addShippingDeviceFlag" column="add_shipping_device_flag" />
<result property="isConfirmReceivingFlag" column="is_confirm_receiving_flag" />
<result property="isConfirmCheckFlag" column="is_confirm_check_flag" />
<result property="startMakeTime" column="start_make_time" />
<result property="endMakeTime" column="end_make_time" />
<result property="addProcessIssueRecordFlag" column="add_process_issue_record_flag" />
@ -57,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select shipping_device_code, shipping_device_id, make_no,sales_order_code, out_order_code, material_no, material_photoUrl, material_name, material_type, material_class, material_model_code, material_unit, material_brand, material_describe,
device_model_code, device_running_number, make_photoUrl, sn_code, aftersales_photoUrl, factory_date, guarantee_period, guarantee_period_flag, lock_date, lock_date_flag, wastage_expire_date, wastage_expire_flag,
component_guarantee_date, component_guarantee_flag, engineer_name, salesman_name, make_name,customer_id, customer_name, maintain_order_code, maintain_time, create_by, create_time, update_by, update_time,
add_shipping_device_flag, is_confirm_receiving_flag, start_make_time, end_make_time, add_process_issue_record_flag,quality_status from aftersales_shipping_device
add_shipping_device_flag,is_confirm_receiving_flag, is_confirm_check_flag,start_make_time, end_make_time, add_process_issue_record_flag,quality_status from aftersales_shipping_device
</sql>
<select id="selectAfterSalesShippingDeviceList" parameterType="AfterSalesShippingDevice" resultMap="AfterSalesShippingDeviceResult">
@ -222,6 +223,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if>
<if test="addShippingDeviceFlag != null">add_shipping_device_flag,</if>
<if test="isConfirmReceivingFlag != null"> is_confirm_receiving_flag,</if>
<if test="isConfirmCheckFlag != null">is_confirm_check_flag,</if>
<if test="startMakeTime != null">start_make_time,</if>
<if test="endMakeTime != null">end_make_time,</if>
<if test="qualityStatus != null">quality_status,</if>
@ -265,11 +267,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="addShippingDeviceFlag != null">#{addShippingDeviceFlag}</if>
<if test="isConfirmReceivingFlag != null">#{isConfirmReceivingFlag}</if>
<if test="startMakeTime != null">#{startMakeTime}</if>
<if test="endMakeTime != null">#{endMakeTime}</if>
<if test="qualityStatus != null">#{qualityStatus}</if>
<if test="addShippingDeviceFlag != null">#{addShippingDeviceFlag},</if>
<if test="isConfirmReceivingFlag != null">#{isConfirmReceivingFlag},</if>
<if test="isConfirmCheckFlag != null">#{isConfirmCheckFlag},</if>
<if test="startMakeTime != null">#{startMakeTime},</if>
<if test="endMakeTime != null">#{endMakeTime},</if>
<if test="qualityStatus != null">#{qualityStatus},</if>
<if test="addProcessIssueRecordFlag != null">#{addProcessIssueRecordFlag}</if>
</trim>
</insert>
@ -316,6 +319,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="addShippingDeviceFlag != null">add_shipping_device_flag = #{addShippingDeviceFlag},</if>
<if test="isConfirmReceivingFlag != null">is_confirm_receiving_flag = #{isConfirmReceivingFlag},</if>
<if test="isConfirmCheckFlag != null">is_confirm_check_flag = #{isConfirmCheckFlag},</if>
<if test="startMakeTime != null">start_make_time = #{startMakeTime},</if>
<if test="endMakeTime != null">end_make_time = #{endMakeTime},</if>
<if test="qualityStatus != null">quality_status = #{qualityStatus},</if>

306
ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/aftersalesConfirmCheck.html

@ -0,0 +1,306 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('确认验收')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: bootstrap-editable-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-aftersalesConfirmCheck-edit" th:object="${sysSalesShippingInform}">
<div class="form-group">
<label class="col-sm-3 control-label">出库单号:</label>
<div class="col-sm-8">
<input name="outOrderCode" th:field="*{outOrderCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">出库类型:</label>
<div class="col-sm-8">
<select name="warehouseOutType" class="form-control m-b" th:with="type=${@dict.getType('warehouse_out_type')}" readonly>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehouseOutType}"></option>
</select>
</div>
</div>
<div th:each="order : ${sysSalesOrders}" class="col-sm-12" style="margin-left: -35px;">
<div class="col-sm-6">
<label class="col-sm-3 control-label">订单类型:</label>
<div class="col-sm-8">
<select name="salesOrderType" class="form-control m-b" readonly>
<option value="0" th:selected="${order.salesOrderType} == '0'">客户订单</option>
<option value="1" th:selected="${order.salesOrderType} == '1'">研发订单</option>
<option value="2" th:selected="${order.salesOrderType} == '2'">其他订单</option>
</select>
</div>
</div>
<div class="col-sm-6" >
<label class="col-sm-3 control-label">销售单号:</label>
<div class="col-sm-8">
<input name="salesOrderCode" th:value="${order.salesOrderCode}" class="form-control" type="text" readonly>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户ID:</label>
<div class="col-sm-8">
<input name="customerId" th:field="*{customerId}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户名称:</label>
<div class="col-sm-8">
<input name="customerName" th:field="*{customerName}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收货联系人(Ship To):</label>
<div class="col-sm-8">
<input name="customerContact" th:field="*{customerContact}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收货电话(Ship To):</label>
<div class="col-sm-8">
<input name="contactNumber" th:field="*{contactNumber}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收货地址(Ship To):</label>
<div class="col-sm-8">
<input name="customerContactAddress" th:field="*{customerContactAddress}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收货联系人(Bill To):</label>
<div class="col-sm-8">
<input name="customerContactBillto" th:field="*{customerContactBillto}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收货电话(Bill To):</label>
<div class="col-sm-8">
<input name="contactNumberBillto" th:field="*{contactNumberBillto}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收货地址(Bill To):</label>
<div class="col-sm-8">
<input name="contactAddressBillto" th:field="*{contactAddressBillto}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input name="remark" th:field="*{remark}" class="form-control" type="text" readonly>
</div>
</div>
</form>
<!--物料信息-->
<div class="container">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<!--用于可以修改列表字段的插件-->
<th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript">
var sysSalesShippingInform = [[${sysSalesShippingInform}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var prefix = ctx + "aftersales/aftersalesOutOrder";
$("#form-aftersalesConfirmCheck-edit").validate({
focusCleanup: true
});
// 新增提交
function submitHandler() {
// 获取表单数据
const sysSalesShippingInformData = $("#form-aftersalesConfirmCheck-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据
var table = $('#bootstrap-table').bootstrapTable('getData');
// 将表数据转换成与complaintNoticeData格式一致的数组
var materialDataList = table.map(function(item) {
// 根据实际字段名调整
return {
"shippingInformDetailId": item.shippingInformDetailId,
"materialCode": item.materialCode,
"materialName": item.materialName,
"materialType": item.materialType,
"materialProcessMethod": item.materialProcessMethod,
"materialModel": item.materialModel,
"shippingDeviceId": item.shippingDeviceId,
"snCode": item.snCode,
"thisShippingNum": item.thisShippingNum,
"hasOutOrderNum": item.hasOutOrderNum,
"hasReceivingNum": item.hasReceivingNum,
"hasCheckNum": item.hasCheckNum,
"thisCheckNum": item.thisCheckNum,
// ...其他字段
};
});
const combinedData = Object.assign({}, sysSalesShippingInformData, {
shippingInformDetailList: materialDataList
});
// 合并表单数据和表格数据
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/aftersalesConfirmCheck", jsonData);
}
//物料信息展示列表
$(function() {
var options = {
modalName: "选择物料",
url: prefix + "/aftersalesConfirmCheckDetailList",
queryParams: queryParams,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
pagination: false, // 设置不分页
columns: [{
checkbox: true
},
{
title: '销售出货通知单详情Id',
field: 'shippingInformDetailId',
visible: false
},
{
title: '料号',
field: 'materialNo',
},
{
title: '物料名称',
field: 'materialName',
},
{
title: '物料类型',
field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
title: '加工方式',
field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
title: '型号',
field: 'materialModel',
},
{
title: '出货设备ID',
field: 'shippingDeviceId',
},
{
title: 'SN码',
field: 'snCode',
},
{
title: '本次出货数',
field: 'thisShippingNum',
},
{
title: '已出库数',
field: 'hasOutOrderNum',
},
{
title: '已收货数',
field: 'hasReceivingNum',
},
{
title: '已验收数',
field: 'hasCheckNum',
},
{
title: '本次验收数',
field: 'thisCheckNum',
editable: {
//动态禁用行内编辑
noEditFormatter: function(value, row, index){
if (row.hasReceivingNum === row.hasCheckNum && row.hasCheckNum !== 0){
return "已验收";
}else if (row.hasReceivingNum === 0){
return "不可验收";
}else {
return false;
}
},
validate: function(value) {
if ($.trim(value) === '') {
return '本次验收数不能为空';
}
if (isNaN(value)) {
return '请输入有效的数字';
}
if (value < 0) {
return '本次验收数不能小于0';
}
//不能为小数
if (value % 1 !== 0) {
return '本次验收数不能为小数';
}
},
},
formatter: function (value, row) {
// 检查 row 是否存在
if (!row) {
return "";
}
// 检查 thisCheckNum 是否存在
if (row.thisCheckNum === undefined || row.thisCheckNum === null) {
return "";
}
// 根据 thisCheckNum 的值决定返回值
if (row.thisCheckNum) {
return row.thisCheckNum;
} else {
return value;
}
}
},
]
};
$.table.init(options);
})
function queryParams(params) {
var curParams = {
// 传递参数查询参数
outOrderCode: sysSalesShippingInform.outOrderCode
};
return curParams;
}
</script>
</body>
</html>

20
ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/aftersalesOutOrder.html

@ -70,8 +70,9 @@
var maintenanceEquipmentOneFlag = [[${@permission.hasPermi('aftersales:aftersalesOutOrder:maintenanceEquipmentOne')}]];
var maintenanceEquipmentTwoFlag = [[${@permission.hasPermi('aftersales:aftersalesOutOrder:maintenanceEquipmentTwo')}]];
var confirmReceivingGoodsFlag = [[${@permission.hasPermi('aftersales:aftersalesOutOrder:confirmReceivingGoods')}]];
var confirmCheckGoodsFlag = [[${@permission.hasPermi('aftersales:aftersalesOutOrder:confirmCheckGoods')}]];
var aftersalesConfirmCheckFlag = [[${@permission.hasPermi('aftersales:aftersalesOutOrder:aftersalesConfirmCheck')}]];
var warehouseOutStatusDatas = [[${@dict.getType('warehouse_out_status')}]];
var warehouseOrderTypeDatas = [[${@dict.getType('warehouse_order_type')}]];
@ -196,12 +197,10 @@
if (row.warehouseOutStatus== "3"){
actions.push('<a class="' + maintenanceEquipmentTwoFlag + '" href="javascript:void(0)" onclick="maintenanceEquipmentTwo(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>维护设备2</a> ');
}
if (row.warehouseOutStatus=="7"){
actions.push('<a class="' + confirmReceivingGoodsFlag + '" href="javascript:void(0)" onclick="confirmReceivingGoods(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>确认收货</a> ');
//待验收和部分验收都能继续验收
if (row.warehouseOutStatus=="10" || row.warehouseOutStatus=="11"){
actions.push('<a class="' + aftersalesConfirmCheckFlag + '" href="javascript:void(0)" onclick="aftersalesConfirmCheck(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>确认验收</a> ');
}
// if (row.warehouseOutStatus=="10"){
// actions.push('<a class="btn btn-success btn-xs ' + confirmCheckGoodsFlag + '" href="javascript:void(0)" onclick="confirmCheckGoods(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>确认验收</a> ');
// }
var actionLinks = actions.join('');
return $.table.dropdownToggle(actionLinks);
@ -227,6 +226,13 @@
}
/*售后确认验收*/
function aftersalesConfirmCheck(outOrderId) {
var url = ctx + 'aftersales/aftersalesOutOrder/aftersalesConfirmCheck/'+outOrderId;
$.modal.open("售后确认验收",url);
}
</script>
</body>
</html>

3
ruoyi-admin/src/main/resources/templates/system/salesShippingInform/confirmReceiving.html

@ -5,9 +5,6 @@
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: bootstrap-editable-css"/>
</head>
<style>
.
</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-confirmReceiving-edit" th:object="${sysSalesShippingInform}">

11
ruoyi-admin/src/main/resources/templates/system/salesShippingInform/salesShippingInform.html

@ -326,10 +326,6 @@
if(row.warehouseOutStatus == '9'){
actions.push('<a class=" ' + confirmReceivingFlag + '" href="javascript:void(0)" onclick="confirmReceiving(\'' + row.shippingInformId + '\')"><i class="fa fa-edit"></i>确认收货</a> ');
}
if(row.warehouseOutStatus == '10' || row.warehouseOutStatus == '11'){
actions.push('<a class="' + customerCheckGoodsFlag + '" href="javascript:void(0)" onclick="customerCheckGoods(\'' + row.shippingInformId + '\')"><i class="fa fa-edit"></i>确认验收</a> ');
}
var actionLinks = actions.join('');
return $.table.dropdownToggle(actionLinks);
}
@ -361,13 +357,6 @@
$.modal.open("确认收货",url);
}
//客户验收
function customerCheckGoods(shippingInformId){
var url = prefix +'/customerCheckGoods/' + shippingInformId;
$.modal.open("客户验收",url);
}
//详情
function customerCheckGoodsDetail(shippingInformId){
var url = prefix +'/customerCheckGoodsDetail/' + shippingInformId;

Loading…
Cancel
Save