Browse Source

[feat] 售后管理 仓库管理

修复售后第一次添加设备 图片字段不对问题
修改售后第一次添加设备 提交设备履历信息JS方法
售后维护设备表新增 是否添加出货设备字段
新增 售后维护设备 修改保存售后第一次维护设备 添加出货设备信息后端接口
修改 售后维护设备 展示售后第一次维护设备料号已选择添加出货设备的相关出货设备信息后端接口
仓库出库单详情新增 添加出货设备列表集合
dev
liuxiaoxu 4 months ago
committed by zhangsiqi
parent
commit
893b0e809f
  1. 27
      ruoyi-admin/src/main/java/com/ruoyi/aftersales/controller/AftersalesWarehouseOutController.java
  2. 12
      ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AfterSalesShippingDevice.java
  3. 6
      ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAftersalesWarehouseOutService.java
  4. 29
      ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesWarehouseOutServiceImpl.java
  5. 16
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseOutOrderDetail.java
  6. 5
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderDetailService.java
  7. 24
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderDetailServiceImpl.java
  8. 7
      ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml
  9. 55
      ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/addShippingDevicesOne.html
  10. 4
      ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/maintenanceEquipmentOne.html

27
ruoyi-admin/src/main/java/com/ruoyi/aftersales/controller/AftersalesWarehouseOutController.java

@ -11,11 +11,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.aftersales.service.IAftersalesWarehouseOutService;
@ -265,15 +261,15 @@ public class AftersalesWarehouseOutController extends BaseController
}
/**
* 展示售后第一次维护设备料号相关出货设备信息
* 展示售后第一次维护设备料号已选择添加出货设备的相关出货设备信息
*/
@PostMapping("/showAftersalesShippingDevicelist")
@PostMapping("/showAftersalesShippingDeviceList")
@ResponseBody
public TableDataInfo showAftersalesShippingDevicelist(WarehouseOutOrder warehouseOutOrder)
public TableDataInfo showAftersalesShippingDeviceList(@RequestParam("materialNo") String materialNo)
{
startPage();
List<SelectShippingDeviceVO> list = warehouseOutOrderService.selectAftersalesShippingDevicelistByCodeAndNo(warehouseOutOrder);
List<SelectShippingDeviceVO> list = warehouseOutOrderService.showAftersalesShippingDeviceList(materialNo);
return getDataTable(list);
}
@ -293,6 +289,17 @@ public class AftersalesWarehouseOutController extends BaseController
/**
* 修改保存售后第一次维护设备 添加出货设备信息
*/
@ResponseBody
@PostMapping("/addShippingDevicesOne")
public AjaxResult addShippingDevicesOne(@RequestBody WarehouseOutOrderDetail warehouseOutOrderDetail)
{
return toAjax(outOrderDetailService.addShippingDevicesOne(warehouseOutOrderDetail));
}
/**
@ -310,8 +317,6 @@ public class AftersalesWarehouseOutController extends BaseController
/**
* 第一次维护设备删除物料信息出货设备信息
*/

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

@ -158,7 +158,8 @@ public class AfterSalesShippingDevice extends BaseEntity
@Excel(name = "维修时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date maintainTime;
/** 是否添加出货设备(0代表是 1代表否) */
private String addShippingDeviceFlag;
public void setShippingDeviceCode(Long shippingDeviceCode)
{
this.shippingDeviceCode = shippingDeviceCode;
@ -464,6 +465,14 @@ public class AfterSalesShippingDevice extends BaseEntity
this.maintainTime = maintainTime;
}
public String getAddShippingDeviceFlag() {
return addShippingDeviceFlag;
}
public void setAddShippingDeviceFlag(String addShippingDeviceFlag) {
this.addShippingDeviceFlag = addShippingDeviceFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -505,6 +514,7 @@ public class AfterSalesShippingDevice extends BaseEntity
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("addShippingDeviceFlag",getAddShippingDeviceFlag())
.toString();
}
}

6
ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAftersalesWarehouseOutService.java

@ -119,4 +119,10 @@ public interface IAftersalesWarehouseOutService
* 展示售后第一次维护设备 添加出货设备 料号相关出货设备信息
* */
List<SelectShippingDeviceVO> selectAftersalesShippingDeviceListByMaterialNo(WarehouseOutOrderDetail warehouseOutOrderDetail);
/**
* 展示售后第一次维护设备料号已选择添加出货设备的相关出货设备信息
* */
List<SelectShippingDeviceVO> showAftersalesShippingDeviceList(String materialNo);
}

29
ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesWarehouseOutServiceImpl.java

@ -2,6 +2,7 @@ package com.ruoyi.aftersales.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import com.ruoyi.aftersales.domain.AfterSalesShippingDevice;
import com.ruoyi.aftersales.domain.vo.SelectMaterialsVO;
@ -211,6 +212,34 @@ public class AftersalesWarehouseOutServiceImpl implements IAftersalesWarehouseOu
return selectShippingDeviceVOs;
}
/**
* 展示售后第一次维护设备料号已选择添加出货设备的相关出货设备信息
* */
@Override
public List<SelectShippingDeviceVO> showAftersalesShippingDeviceList(String materialNo) {
List<SelectShippingDeviceVO> selectShippingDeviceVOs = new ArrayList<>();
AfterSalesShippingDevice afterSalesShippingDevice = new AfterSalesShippingDevice();
afterSalesShippingDevice.setMaterialNo(materialNo);
List<AfterSalesShippingDevice> afterSalesShippingDevices = shippingDeviceMapper.selectShippingDeviceListByMaterialNo(afterSalesShippingDevice);
List<AfterSalesShippingDevice> filterAfterSalesShippingDevices = afterSalesShippingDevices.stream().filter(shippingDevice -> "0".equals(shippingDevice.getAddShippingDeviceFlag())).collect(Collectors.toList());
if (!StringUtils.isNotEmpty(filterAfterSalesShippingDevices)) {
// 记录日志
log.warn("未查找到与物料号关联的出库设备数据, 物料号: {}",materialNo);
}
for (AfterSalesShippingDevice tempAfterSalesShippingDevice : filterAfterSalesShippingDevices) {
SelectShippingDeviceVO shippingDeviceVO = new SelectShippingDeviceVO();
shippingDeviceVO.setShippingDeviceId(tempAfterSalesShippingDevice.getShippingDeviceId());
shippingDeviceVO.setDeviceModelCode(tempAfterSalesShippingDevice.getDeviceModelCode());
shippingDeviceVO.setDeviceRunningNumber(tempAfterSalesShippingDevice.getDeviceRunningNumber());
shippingDeviceVO.setMakePhotoUrl(tempAfterSalesShippingDevice.getMakePhotourl());
shippingDeviceVO.setQuoteId(tempAfterSalesShippingDevice.getSalesOrderCode());
selectShippingDeviceVOs.add(shippingDeviceVO);
}
return selectShippingDeviceVOs;
}
/*
* 售后第一次维护设备信息根据设备ID删除出货设备信息
* */

16
ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseOutOrderDetail.java

@ -1,7 +1,10 @@
package com.ruoyi.warehouse.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.aftersales.domain.vo.SelectShippingDeviceVO;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
@ -199,6 +202,10 @@ public class WarehouseOutOrderDetail extends BaseEntity
@Excel(name = "收货电话")
private String deliveryNumber;
/** 添加出货设备列表*/
private List<SelectShippingDeviceVO> SelectShippingDeviceVOList;
public void setOutOrderDetailId(Long outOrderDetailId)
{
this.outOrderDetailId = outOrderDetailId;
@ -605,6 +612,14 @@ public class WarehouseOutOrderDetail extends BaseEntity
return deliveryNumber;
}
public List<SelectShippingDeviceVO> getSelectShippingDeviceVOList() {
return SelectShippingDeviceVOList;
}
public void setSelectShippingDeviceVOList(List<SelectShippingDeviceVO> selectShippingDeviceVOList) {
SelectShippingDeviceVOList = selectShippingDeviceVOList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -658,6 +673,7 @@ public class WarehouseOutOrderDetail extends BaseEntity
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("selectShippingDeviceVOList",getSelectShippingDeviceVOList())
.toString();
}
}

5
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderDetailService.java

@ -91,4 +91,9 @@ public interface IWarehouseOutOrderDetailService
* 退换货-出库 供应商物料详情列表
*/
List<WarehouseOutOrderDetail> selectWarehouseOutOrderDetailListByCode(String outOrderCode);
/**
* 修改保存售后第一次维护设备 添加出货设备信息
*/
int addShippingDevicesOne(WarehouseOutOrderDetail warehouseOutOrderDetail);
}

24
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderDetailServiceImpl.java

@ -3,7 +3,9 @@ package com.ruoyi.warehouse.service.impl;
import java.util.List;
import com.ruoyi.aftersales.domain.AfterSalesShippingDevice;
import com.ruoyi.aftersales.domain.vo.SelectShippingDeviceVO;
import com.ruoyi.aftersales.mapper.AfterSalesShippingDeviceMapper;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
@ -16,6 +18,7 @@ import com.ruoyi.warehouse.mapper.WarehouseOutOrderDetailMapper;
import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail;
import com.ruoyi.warehouse.service.IWarehouseOutOrderDetailService;
import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
/**
* 出库单详情Service业务层处理
@ -165,4 +168,25 @@ public class WarehouseOutOrderDetailServiceImpl implements IWarehouseOutOrderDet
return warehouseOutOrderDetailMapper.selectOutOrderDetailListByCode(outOrderCode);
}
/**
* 修改保存售后第一次维护设备 添加出货设备信息
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int addShippingDevicesOne(WarehouseOutOrderDetail warehouseOutOrderDetail) {
List<SelectShippingDeviceVO> selectShippingDeviceVOList = warehouseOutOrderDetail.getSelectShippingDeviceVOList();
int updateShippingDeviceResult = 0;
for (SelectShippingDeviceVO selectShippingDeviceVO : selectShippingDeviceVOList) {
AfterSalesShippingDevice afterSalesShippingDevice = new AfterSalesShippingDevice();
afterSalesShippingDevice.setShippingDeviceId(selectShippingDeviceVO.getShippingDeviceId());
//设置为已经添加出货设备
afterSalesShippingDevice.setAddShippingDeviceFlag("0");
updateShippingDeviceResult += afterSalesShippingDeviceMapper.updateAfterSalesShippingDevice(afterSalesShippingDevice);
if (updateShippingDeviceResult <= 0){
throw new BusinessException("更新出货设备信息失败");
}
}
return updateShippingDeviceResult;
}
}

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

@ -43,10 +43,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="addShippingDeviceFlag" column="add_shipping_device_flag" />
</resultMap>
<sql id="selectAfterSalesShippingDeviceVo">
select shipping_device_code, shipping_device_id, make_no,sales_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 from aftersales_shipping_device
select shipping_device_code, shipping_device_id, make_no,sales_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 from aftersales_shipping_device
</sql>
<select id="selectAfterSalesShippingDeviceList" parameterType="AfterSalesShippingDevice" resultMap="AfterSalesShippingDeviceResult">
@ -148,6 +150,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="addShippingDeviceFlag != null">add_shipping_device_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="shippingDeviceId != null and shippingDeviceId != ''">#{shippingDeviceId},</if>
@ -186,6 +189,7 @@ 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>
</trim>
</insert>
@ -228,6 +232,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="addShippingDeviceFlag != null">add_shipping_device_flag = #{addShippingDeviceFlag},</if>
</trim>
where shipping_device_id= #{shippingDeviceId}
</update>

55
ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/addShippingDevicesOne.html

@ -17,7 +17,7 @@
<div class="form-group">
<label class="col-sm-4 control-label">图片:</label>
<div class="col-sm-8">
<input readonly name="materialPhotoUrl" th:field="*{materialPhotoUrl}" class="form-control" type="text">
<input readonly name="materialPhotourl" th:field="*{materialPhotourl}" class="form-control" type="text">
</div>
</div>
@ -111,12 +111,47 @@
focusCleanup: true
});
/*
* 提交设备履历信息
* */
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-addShippingDevicesOne-edit').serialize());
// 获取表单数据
const shippingDevicesData = $("#form-addShippingDevicesOne-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据
// var table = $('#table-shippingDevices').bootstrapTable('getData');
//获取选中复选框行的数据
const selectedRows = $("#table-shippingDevices").bootstrapTable('getSelections');
// 检查表格数据是否为空
if (selectedRows.length===0){
$.modal.alertWarning("请至少选择一条出货设备信息后再保存!");
return;
}
// 将表数据转换成与complaintNoticeData格式一致的数组
var equipDetailDataList = selectedRows.map(function(item) {
// 根据实际字段名调整
return {
"shippingDeviceId": item.shippingDeviceId,
"deviceModelCode": item.deviceModelCode,
"deviceRunningNumber": item.deviceRunningNumber,
"makePhotoUrl": item.makePhotoUrl
// ...其他字段
};
});
// 合并表单数据和表格数据
const combinedData = Object.assign({}, shippingDevicesData, { selectShippingDeviceVOList: equipDetailDataList });
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/addShippingDevicesOne", jsonData);
}
$("input[name='outOrderTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
@ -195,7 +230,7 @@
$(function(){
var options = {
id: "form-equipMaterialDetail-add",
id: "table-shippingDevices",
url: prefix + "/getEquipMaterialDetailByMaterialNo",
pagination: false,
showSearch: false,
@ -217,22 +252,22 @@
}
},
{
field: 'equipmentId',
field: 'shippingDeviceId',
align: 'center',
title: '出货设备id',
},
{
field: 'equipmentModel',
field: 'deviceModelCode',
align: 'center',
title: '设备型号',
},
{
field: 'serialNo',
field: 'deviceRunningNumber',
align: 'center',
title: '流水号',
},
{
field: 'producePic',
field: 'makePhotoUrl',
align: 'center',
title: '生产图片',
},
@ -259,10 +294,10 @@
}
function removeRow(index) {
var data = $('#form-equipMaterialDetail-add').bootstrapTable('getData');
var data = $('#table-shippingDevices').bootstrapTable('getData');
var row = data[index]; // 获取要删除的行数据
if (row) {
$('#form-equipMaterialDetail-add').bootstrapTable('remove', {
$('#table-shippingDevices').bootstrapTable('remove', {
field: 'equipmentIndex',
values: [row.equipmentIndex]
});

4
ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/maintenanceEquipmentOne.html

@ -200,12 +200,12 @@
var childTableId = 'child_table_'+index;
$detail.html('<table id="'+childTableId+'"></table>');
$('#'+childTableId).bootstrapTable({
url: prefix + "/showAftersalesShippingDevicelist",
url: prefix + "/showAftersalesShippingDeviceList",
method: 'post',
sidePagination: "server",
contentType: "application/x-www-form-urlencoded",
queryParams : {
salesOrderCode: warehouseOutOrder.salesOrderCode,
// salesOrderCode: warehouseOutOrder.salesOrderCode,
materialNo: parentRow.materialNo
},
columns: [

Loading…
Cancel
Save