Browse Source

[feat]仓库管理:

出库单
新增退换货-出库 按钮
新增退换货---出库页面refundsExchangesOutWarehouse.html
新增退换货---出库后端查询页面接口
新增退换货---出库后端修改保存接口
新增退换货-出库 查询供应商物料详情列表接口
dev
liuxiaoxu 5 months ago
parent
commit
90edd90b02
  1. 38
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseOutOrderController.java
  2. 2
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseOutOrderDetailMapper.java
  3. 6
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderDetailService.java
  4. 4
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderService.java
  5. 10
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderDetailServiceImpl.java
  6. 23
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java
  7. 1
      ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseOutOrderDetailMapper.xml
  8. 216
      ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/refundsExchangesOutWarehouse.html
  9. 12
      ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/warehouseOutOrder.html

38
ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseOutOrderController.java

@ -1,9 +1,12 @@
package com.ruoyi.warehouse.controller; package com.ruoyi.warehouse.controller;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.ruoyi.aftersales.domain.AfterSalesShippingDevice; import com.ruoyi.aftersales.domain.AfterSalesShippingDevice;
import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail; import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail;
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail;
import com.ruoyi.warehouse.service.IWarehouseOutOrderDetailService; import com.ruoyi.warehouse.service.IWarehouseOutOrderDetailService;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -238,4 +241,39 @@ public class WarehouseOutOrderController extends BaseController
return toAjax(warehouseOutOrderService.updatePrepareMaterial(warehouseOutOrder)); return toAjax(warehouseOutOrderService.updatePrepareMaterial(warehouseOutOrder));
} }
/**
* 退换货-出库
*/
@GetMapping("/refundsExchangesOutWarehouse/{outOrderId}")
public String refundsExchangesOutWarehouse(@PathVariable("outOrderId") Long outOrderId, ModelMap mmap)
{
WarehouseOutOrder warehouseOutOrder = warehouseOutOrderService.selectWarehouseOutOrderById(outOrderId);
mmap.put("warehouseOutOrder", warehouseOutOrder);
return prefix + "/refundsExchangesOutWarehouse";
}
/**
* 修改保存退换货-出库
*/
@RequiresPermissions("warehouse:warehouseOutOrder:refundsExchangesOutWarehouse")
@Log(title = "仓库出库单", businessType = BusinessType.UPDATE)
@PostMapping("/refundsExchangesOutWarehouse")
@ResponseBody
public AjaxResult refundsExchangesOutWarehouseSave(@RequestBody WarehouseOutOrder warehouseOutOrder)
{
return toAjax(warehouseOutOrderService.updateRefundsExchangesOutWarehouse(warehouseOutOrder));
}
/**
* 退换货-出库 供应商物料详情列表
*/
@ResponseBody
@RequestMapping("/refundsExchangesDetailList")
public Map<String,List<WarehouseOutOrderDetail>> refundsExchangesDetailList(String outOrderCode){
List<WarehouseOutOrderDetail> allDetails = outOrderDetailService.selectWarehouseOutOrderDetailListByCode(outOrderCode);
Map<String, List<WarehouseOutOrderDetail>> groupedDetails = allDetails.stream().collect(Collectors.groupingBy(WarehouseOutOrderDetail::getSupplierCode));
return groupedDetails;
}
} }

2
ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseOutOrderDetailMapper.java

@ -4,6 +4,7 @@ import java.util.List;
import com.ruoyi.warehouse.domain.WarehouseOutOrder; import com.ruoyi.warehouse.domain.WarehouseOutOrder;
import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail; import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail;
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail;
/** /**
* 出库单详情Mapper接口 * 出库单详情Mapper接口
@ -86,4 +87,5 @@ public interface WarehouseOutOrderDetailMapper
* 销售单-出库 物料信息关联设备信息 * 销售单-出库 物料信息关联设备信息
*/ */
List<WarehouseOutOrderDetail> selectShippingDeviceList(WarehouseOutOrderDetail warehouseOutOrderDetail); List<WarehouseOutOrderDetail> selectShippingDeviceList(WarehouseOutOrderDetail warehouseOutOrderDetail);
} }

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

@ -5,6 +5,7 @@ import java.util.List;
import com.ruoyi.aftersales.domain.AfterSalesShippingDevice; import com.ruoyi.aftersales.domain.AfterSalesShippingDevice;
import com.ruoyi.warehouse.domain.WarehouseOutOrder; import com.ruoyi.warehouse.domain.WarehouseOutOrder;
import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail; import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail;
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail;
/** /**
* 出库单详情Service接口 * 出库单详情Service接口
@ -85,4 +86,9 @@ public interface IWarehouseOutOrderDetailService
* 销售单-出库 物料信息关联设备信息 * 销售单-出库 物料信息关联设备信息
*/ */
List<AfterSalesShippingDevice> selectShippingDeviceList(AfterSalesShippingDevice afterSalesShippingDevice); List<AfterSalesShippingDevice> selectShippingDeviceList(AfterSalesShippingDevice afterSalesShippingDevice);
/**
* 退换货-出库 供应商物料详情列表
*/
List<WarehouseOutOrderDetail> selectWarehouseOutOrderDetailListByCode(String outOrderCode);
} }

4
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderService.java

@ -83,4 +83,8 @@ public interface IWarehouseOutOrderService
*/ */
int updateSalesOutWarehouse(WarehouseOutOrder warehouseOutOrder); int updateSalesOutWarehouse(WarehouseOutOrder warehouseOutOrder);
/**
* 修改保存销售单-出库
*/
int updateRefundsExchangesOutWarehouse(WarehouseOutOrder warehouseOutOrder);
} }

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

@ -8,6 +8,7 @@ import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.warehouse.domain.WarehouseOutOrder; import com.ruoyi.warehouse.domain.WarehouseOutOrder;
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -155,4 +156,13 @@ public class WarehouseOutOrderDetailServiceImpl implements IWarehouseOutOrderDet
return afterSalesShippingDeviceMapper.selectShippingDeviceList(afterSalesShippingDevice); return afterSalesShippingDeviceMapper.selectShippingDeviceList(afterSalesShippingDevice);
} }
/**
* 退换货-出库 供应商物料详情列表
*/
@Override
public List<WarehouseOutOrderDetail> selectWarehouseOutOrderDetailListByCode(String outOrderCode) {
return warehouseOutOrderDetailMapper.selectOutOrderDetailListByCode(outOrderCode);
}
} }

23
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java

@ -188,4 +188,27 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
} }
return updateRows; return updateRows;
} }
/**
* 修改保存退换货-出库
*/
@Transactional
@Override
public int updateRefundsExchangesOutWarehouse(WarehouseOutOrder warehouseOutOrder) {
String loginName = ShiroUtils.getLoginName();
List<WarehouseOutOrderDetail> warehouseOutOrderDetailList = warehouseOutOrder.getWarehouseOutOrderDetailList();
if (StringUtils.isEmpty(warehouseOutOrderDetailList)){
log.warn("退换货-出库,物料列表信息为空:{}",warehouseOutOrder);
}
int updateRows = 0;
for (WarehouseOutOrderDetail warehouseOutOrderDetail : warehouseOutOrderDetailList) {
warehouseOutOrderDetail.setUpdateBy(loginName);
warehouseOutOrderDetail.setUpdateTime(new Date());
//更新数据库记录
updateRows += outOrderDetailMapper.updateWarehouseOutOrderDetail(warehouseOutOrderDetail);
}
return updateRows;
}
} }

1
ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseOutOrderDetailMapper.xml

@ -83,7 +83,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and material_no = #{materialNo} and material_no = #{materialNo}
</select> </select>
<insert id="insertWarehouseOutOrderDetail" parameterType="WarehouseOutOrderDetail" useGeneratedKeys="true" keyProperty="outOrderDetailId"> <insert id="insertWarehouseOutOrderDetail" parameterType="WarehouseOutOrderDetail" useGeneratedKeys="true" keyProperty="outOrderDetailId">
insert into warehouse_out_order_detail insert into warehouse_out_order_detail
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

216
ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/refundsExchangesOutWarehouse.html

@ -0,0 +1,216 @@
<!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" />
<style>
.supplier-value span {
margin-right: 10px;
}
</style>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-refundsExchangesOutWarehouse-edit" th:object="${warehouseOutOrder}">
<input name="outOrderId" th:field="*{outOrderId}" type="hidden">
<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" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">订单类型:</label>
<div class="col-sm-8">
<select name="warehouseOrderType" class="form-control m-b" th:with="type=${@dict.getType('warehouse_order_type')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehouseOrderType}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">关联单号:</label>
<div class="col-sm-8">
<input name="relatedOrderCode" th:field="*{relatedOrderCode}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">申请人员:</label>
<div class="col-sm-8">
<input name="applyName" th:field="*{applyName}" class="form-control" type="text" disabled>
</div>
</div>
<div class="container">
<!--供应商物料相关-->
<div class="row">
<div class="col-sm-12" id="tablesContainer">
<!-- 表格将在这里动态生成 -->
</div>
</div>
</div>
</form>
</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 outOrderCode = [[${warehouseOutOrder.outOrderCode}]]
var prefix = ctx + "warehouse/warehouseOutOrder";
$("#form-refundsExchangesOutWarehouse-edit").validate({
focusCleanup: true
});
//生成的不同table的id集合
var tableDatas = [];
function submitHandler() {
const warehouseStorageOrderData = $("#form-refundsExchangesOutWarehouse-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 初始化一个数组用于存放所有表格的数据
let allMaterialDataList = [];
for(let i in tableDatas){
$('#' + tableDatas[i]).each(function() {
const tableData = $(this).bootstrapTable('getData');
console.log(JSON.stringify(tableData));
// 将表数据转换成与qualityReportData格式一致的数组
var materialDataList = tableData.map(function (item) {
// 根据实际字段名调整
return {
"supplierCode": item.supplierCode,
"materialNo": item.materialNo,
"actualOutOrderSum":item.actualOutOrderSum,
"outOrderDetailId":item.outOrderDetailId,
"outOrderCode":item.outOrderCode,
// ...其他字段
};
});
allMaterialDataList = allMaterialDataList.concat(materialDataList);
});
}
const combinedData = Object.assign({}, warehouseStorageOrderData, {
warehouseOutOrderDetailList: allMaterialDataList
});
// 合并表单数据和表格数据
// const combinedData = Object.assign({}, ...complaintNoticeData.array(item => ({ [item.name]: item.value })), ...materialData);
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/refundsExchangesOutWarehouse", jsonData);
}
$(function() {
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到
var outOrderCode = [[${warehouseOutOrder.outOrderCode}]]; // 这里需要实际赋值,比如从前端某个地方读取
$.getJSON(prefix + "/refundsExchangesDetailList?outOrderCode=" + outOrderCode, function(data) {
for (var supplierCode in data) {
if (data.hasOwnProperty(supplierCode)) {
var supplierData = data[supplierCode];
createTableForSupplier(supplierCode, supplierData);
}
}
});
});
function createTableForSupplier(supplierCode, supplierData) {
var tableId = 'bootstrap-table-' + supplierCode.replace(/[^a-z0-9]/gi, '_').toLowerCase();
tableDatas.push(tableId);
var $tableWrapper = $('<div class="table-responsive mt-3"></div>');
// 确保supplierData至少有一条记录,并从中提取供应商详细信息
var supplierInfo = supplierData.length > 0 ? supplierData[0] : {}; // 默认为空对象,以防数据不存在
// 构建含有额外供应商信息的标题字符串
var headerTitle ='供应商'+'</br>'+supplierCode + ' - ' + (supplierInfo.supplierName || 'N/A') +
' </br> ' + (supplierInfo.deliveryName || 'N/A') +
' - ' + (supplierInfo.deliveryNumber || 'N/A') +
' - ' + (supplierInfo.deliveryAddress || 'N/A');
var $header = $('<h4>' + headerTitle + '</h4>');
var $table = $('<table id="' + tableId + '" class="table table-striped table-bordered"></table>');
$table.bootstrapTable({
data: supplierData,
columns: [{
checkbox: true
},
{
title: '出库单详情ID',
field: 'outOrderDetailId',
visible: false
},
{
title: '出库单号',
field: 'outOrderCode',
visible: false
},
{
title: '料号',
field: 'materialNo',
},
{
title: '图片',
field: 'materialPhotourl',
},
{
title: '物料名称',
field: 'materialName',
},
{
title: '物料类型',
field: 'materialType',
},
{
title: '描述',
field: 'materialDescribe',
},
{
title: '品牌',
field: 'materialBrand',
},
{
title: '单位',
field: 'materialUnit',
},
{
title: '加工方式',
field: 'materialProcessMethod',
},
{
title: '订单数量',
field: 'makeNum',
},
{
title: '已出库数',
field: 'hasOutOrderSum',
},
{
title: '申请出库数',
field: 'applyOutOrderSum',
},
{
title: '实际出库数',
field: 'actualOutOrderSum',
editable:true
}
]
});
$tableWrapper.append($header).append($table);
$('#tablesContainer').append($tableWrapper);
}
</script>
</body>
</html>

12
ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/warehouseOutOrder.html

@ -73,6 +73,7 @@
var makeOutWarehouseFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:makeOutWarehouse')}]]; var makeOutWarehouseFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:makeOutWarehouse')}]];
var requisitioningOutWarehouseFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:requisitioningOutWarehouse')}]]; var requisitioningOutWarehouseFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:requisitioningOutWarehouse')}]];
var refundsExchangesOutWarehouseFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:refundsExchangesOutWarehouse')}]];
var warehouseOutStatusDatas = [[${@dict.getType('warehouse_out_status')}]]; var warehouseOutStatusDatas = [[${@dict.getType('warehouse_out_status')}]];
var warehouseOrderTypeDatas = [[${@dict.getType('warehouse_order_type')}]]; var warehouseOrderTypeDatas = [[${@dict.getType('warehouse_order_type')}]];
@ -193,7 +194,10 @@
actions.push('<a class="btn btn-success btn-xs ' + requisitioningOutWarehouseFlag + '" href="javascript:void(0)" onclick="requisitioningOutWarehouse(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>出库</a> '); actions.push('<a class="btn btn-success btn-xs ' + requisitioningOutWarehouseFlag + '" href="javascript:void(0)" onclick="requisitioningOutWarehouse(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>出库</a> ');
} }
/*退换货-出库*/
if (row.warehouseOutStatus == 4 && row.warehouseOrderType == 4 && row.warehouseOutType == 4){
actions.push('<a class="btn btn-success btn-xs ' + refundsExchangesOutWarehouseFlag + '" href="javascript:void(0)" onclick="refundsExchangesOutWarehouse(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>出库</a> ');
}
return actions.join(''); return actions.join('');
} }
}] }]
@ -224,6 +228,12 @@
var url = ctx + 'warehouse/warehouseOutOrder/requisitioningOutWarehouse/' + outOrderId; var url = ctx + 'warehouse/warehouseOutOrder/requisitioningOutWarehouse/' + outOrderId;
$.modal.open("出库",url); $.modal.open("出库",url);
} }
/*退换货-出库*/
function refundsExchangesOutWarehouse(outOrderId){
var url = ctx + 'warehouse/warehouseOutOrder/refundsExchangesOutWarehouse/' + outOrderId;
$.modal.open("出库",url);
}
</script> </script>
</body> </body>
</html> </html>
Loading…
Cancel
Save