Browse Source

[feat]仓库管理:

新增 *销售单**-**准备物料* 页面 prepareMaterial.html
新增 *销售单**-**准备物料*  按钮
新增 *销售单**-**准备物料*  修改保存后端接口
新增 *销售单**-**准备物料*  查询后端接口
新增 *销售单**-**准备物料  查询物料相关信息*接口
新增 出库单详情集合字段
dev
liuxiaoxu 5 months ago
parent
commit
4b6cf5a085
  1. 51
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseOutOrderController.java
  2. 15
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseOutOrder.java
  3. 7
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseOutOrderDetailMapper.java
  4. 7
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderDetailService.java
  5. 5
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderService.java
  6. 17
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderDetailServiceImpl.java
  7. 27
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java
  8. 8
      ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseOutOrderDetailMapper.xml
  9. 226
      ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/prepareMaterial.html
  10. 12
      ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/warehouseOutOrder.html

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

@ -1,15 +1,14 @@
package com.ruoyi.warehouse.controller;
import java.util.List;
import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail;
import com.ruoyi.warehouse.service.IWarehouseOutOrderDetailService;
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.warehouse.domain.WarehouseOutOrder;
@ -34,6 +33,9 @@ public class WarehouseOutOrderController extends BaseController
@Autowired
private IWarehouseOutOrderService warehouseOutOrderService;
@Autowired
private IWarehouseOutOrderDetailService outOrderDetailService;
@RequiresPermissions("warehouse:warehouseOutOrder:view")
@GetMapping()
public String warehouseOutOrder()
@ -113,38 +115,39 @@ public class WarehouseOutOrderController extends BaseController
}
/**
* 删除仓库出库单
* 销售单-准备物料
*/
@RequiresPermissions("warehouse:warehouseOutOrder:remove")
@Log(title = "仓库出库单", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
@GetMapping("/prepareMaterial/{outOrderId}")
public String prepareMaterial(@PathVariable("outOrderId") Long outOrderId, ModelMap mmap)
{
return toAjax(warehouseOutOrderService.deleteWarehouseOutOrderByIds(ids));
WarehouseOutOrder warehouseOutOrder = warehouseOutOrderService.selectWarehouseOutOrderById(outOrderId);
mmap.put("warehouseOutOrder", warehouseOutOrder);
return prefix + "/prepareMaterial";
}
/**
* 作废仓库出库单
* 修改保存销售单-准备物料
*/
@RequiresPermissions("warehouse:warehouseOutOrder:cancel")
@Log(title = "仓库出库单", businessType = BusinessType.CANCEL)
@GetMapping( "/cancel/{id}")
@RequiresPermissions("warehouse:warehouseOutOrder:prepareMaterial")
@Log(title = "仓库出库单", businessType = BusinessType.UPDATE)
@PostMapping("/prepareMaterial")
@ResponseBody
public AjaxResult cancel(@PathVariable("id") Long id){
return toAjax(warehouseOutOrderService.cancelWarehouseOutOrderById(id));
public AjaxResult prepareMaterialSave(@RequestBody WarehouseOutOrder warehouseOutOrder)
{
return toAjax(warehouseOutOrderService.updatePrepareMaterial(warehouseOutOrder));
}
/**
* 恢复仓库出库单
* 销售单-准备物料 物料相关信息
*/
@RequiresPermissions("warehouse:warehouseOutOrder:restore")
@Log(title = "仓库出库单", businessType = BusinessType.RESTORE)
@GetMapping( "/restore/{id}")
@PostMapping("/getMaterialListByOutOrderCode")
@ResponseBody
public AjaxResult restore(@PathVariable("id")Long id)
public TableDataInfo getMaterialListByOutOrderCode(WarehouseOutOrder warehouseOutOrder)
{
return toAjax(warehouseOutOrderService.restoreWarehouseOutOrderById(id));
startPage();
List<WarehouseOutOrderDetail> list = outOrderDetailService.selectOutOrderDetailListByCode(warehouseOutOrder);
return getDataTable(list);
}

15
ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseOutOrder.java

@ -1,6 +1,8 @@
package com.ruoyi.warehouse.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -125,6 +127,9 @@ public class WarehouseOutOrder extends BaseEntity
/** 送货日期 */
private Date deliveryDate;
/** 仓库出库单详情*/
private List<WarehouseOutOrderDetail> warehouseOutOrderDetailList;
public void setOutOrderId(Long outOrderId)
{
this.outOrderId = outOrderId;
@ -414,6 +419,15 @@ public class WarehouseOutOrder extends BaseEntity
return deliveryDate;
}
public List<WarehouseOutOrderDetail> getWarehouseOutOrderDetailList() {
return warehouseOutOrderDetailList;
}
public void setWarehouseOutOrderDetailList(List<WarehouseOutOrderDetail> warehouseOutOrderDetailList) {
this.warehouseOutOrderDetailList = warehouseOutOrderDetailList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -454,6 +468,7 @@ public class WarehouseOutOrder extends BaseEntity
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("warehouseOutOrderDetailList",getWarehouseOutOrderDetailList())
.toString();
}
}

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

@ -1,6 +1,8 @@
package com.ruoyi.warehouse.mapper;
import java.util.List;
import com.ruoyi.warehouse.domain.WarehouseOutOrder;
import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail;
/**
@ -74,4 +76,9 @@ public interface WarehouseOutOrderDetailMapper
* @return 结果
*/
public int restoreWarehouseOutOrderDetailById(Long outOrderDetailId);
/**
* 销售单-准备物料 物料相关信息
*/
List<WarehouseOutOrderDetail> selectOutOrderDetailListByCode(String outOrderCode);
}

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

@ -1,6 +1,8 @@
package com.ruoyi.warehouse.service;
import java.util.List;
import com.ruoyi.warehouse.domain.WarehouseOutOrder;
import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail;
/**
@ -72,4 +74,9 @@ public interface IWarehouseOutOrderDetailService
* @return
*/
int restoreWarehouseOutOrderDetailById(Long outOrderDetailId);
/**
* 销售单-准备物料 物料相关信息
*/
List<WarehouseOutOrderDetail> selectOutOrderDetailListByCode(WarehouseOutOrder warehouseOutOrder);
}

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

@ -72,4 +72,9 @@ public interface IWarehouseOutOrderService
* @return
*/
int restoreWarehouseOutOrderById(Long outOrderId);
/**
* 修改保存销售单-准备物料
*/
int updatePrepareMaterial(WarehouseOutOrder warehouseOutOrder);
}

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

@ -3,6 +3,9 @@ package com.ruoyi.warehouse.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.warehouse.domain.WarehouseOutOrder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.warehouse.mapper.WarehouseOutOrderDetailMapper;
@ -17,6 +20,7 @@ import com.ruoyi.common.core.text.Convert;
* @date 2024-06-04
*/
@Service
@Slf4j
public class WarehouseOutOrderDetailServiceImpl implements IWarehouseOutOrderDetailService
{
@Autowired
@ -123,4 +127,17 @@ public class WarehouseOutOrderDetailServiceImpl implements IWarehouseOutOrderDet
{
return warehouseOutOrderDetailMapper.restoreWarehouseOutOrderDetailById(outOrderDetailId);
}
/**
* 销售单-准备物料 物料相关信息
*/
@Override
public List<WarehouseOutOrderDetail> selectOutOrderDetailListByCode(WarehouseOutOrder warehouseOutOrder) {
String outOrderCode = warehouseOutOrder.getOutOrderCode();
if (StringUtils.isEmpty(outOrderCode)){
log.warn("销售单-准备物料,出库单号为空:{}",outOrderCode);
}
return warehouseOutOrderDetailMapper.selectOutOrderDetailListByCode(outOrderCode);
}
}

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

@ -3,6 +3,10 @@ package com.ruoyi.warehouse.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail;
import com.ruoyi.warehouse.mapper.WarehouseOutOrderDetailMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.warehouse.mapper.WarehouseOutOrderMapper;
@ -17,11 +21,15 @@ import com.ruoyi.common.core.text.Convert;
* @date 2024-06-04
*/
@Service
@Slf4j
public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
{
@Autowired
private WarehouseOutOrderMapper warehouseOutOrderMapper;
@Autowired
private WarehouseOutOrderDetailMapper outOrderDetailMapper;
/**
* 查询仓库出库单
*
@ -123,4 +131,23 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
{
return warehouseOutOrderMapper.restoreWarehouseOutOrderById(outOrderId);
}
/**
* 修改保存销售单-准备物料
* */
@Override
public int updatePrepareMaterial(WarehouseOutOrder warehouseOutOrder) {
List<WarehouseOutOrderDetail> warehouseOutOrderDetailList = warehouseOutOrder.getWarehouseOutOrderDetailList();
if (StringUtils.isEmpty(warehouseOutOrderDetailList)){
log.warn("保存销售单-准备物料,物料列表信息为空:{}",warehouseOutOrder);
}
int updateRows = 0;
for (WarehouseOutOrderDetail warehouseOutOrderDetail : warehouseOutOrderDetailList) {
//更新数据库记录
updateRows += outOrderDetailMapper.updateWarehouseOutOrderDetail(warehouseOutOrderDetail);
}
return updateRows;
}
}

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

@ -71,7 +71,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectWarehouseOutOrderDetailVo"/>
where out_order_detail_id = #{outOrderDetailId}
</select>
<select id="selectOutOrderDetailListByCode" parameterType="String" resultMap="WarehouseOutOrderDetailResult">
<include refid="selectWarehouseOutOrderDetailVo"/>
where out_order_code = #{outOrderCode}
</select>
<insert id="insertWarehouseOutOrderDetail" parameterType="WarehouseOutOrderDetail" useGeneratedKeys="true" keyProperty="outOrderDetailId">
insert into warehouse_out_order_detail
<trim prefix="(" suffix=")" suffixOverrides=",">

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

@ -0,0 +1,226 @@
<!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" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-prepareMaterial-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">
</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')}">
<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="salesOrderCode" th:field="*{salesOrderCode}" class="form-control" type="text">
</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">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">生产单号:</label>
<div class="col-sm-8">
<input name="makeNo" th:field="*{makeNo}" class="form-control" type="text">
</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">
</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">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收货联系人:</label>
<div class="col-sm-8">
<input name="deliveryName" th:field="*{deliveryName}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收货电话:</label>
<div class="col-sm-8">
<input name="deliveryNumber" th:field="*{deliveryNumber}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收货地址:</label>
<div class="col-sm-8">
<input name="deliveryAddress" th:field="*{deliveryAddress}" class="form-control" type="text">
</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">
</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 warehouseOutOrder = [[${warehouseOutOrder}]];
var prefix = ctx + "warehouse/warehouseOutOrder";
$("#form-prepareMaterial-edit").validate({
focusCleanup: true
});
// 新增提交
function submitHandler() {
// 获取表单数据
const warehouseOutOrderData = $("#form-prepareMaterial-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 {
"outOrderDetailId":item.outOrderDetailId,
"outOrderCode":item.outOrderCode,
"materialNo": item.materialNo, // 假设id对应materialId
"prepareOutOrderSum":item.prepareOutOrderSum,
// ...其他字段
};
});
const combinedData = Object.assign({}, warehouseOutOrderData, {
warehouseOutOrderDetailList: materialDataList,
});
// 合并表单数据和表格数据
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/prepareMaterial", jsonData);
}
//物料信息展示列表
$(function() {
var options = {
modalName: "选择物料",
url: ctx + "warehouse/warehouseOutOrder/getMaterialListByOutOrderCode",
queryParams: queryParams,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
pagination: false, // 设置不分页
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: 'prepareOutOrderSum',
editable:true,
},
]
};
$.table.init(options);
})
function queryParams(params) {
var curParams = {
// 传递参数查询参数
outOrderCode: warehouseOutOrder.outOrderCode
};
console.log(curParams);
return curParams;
}
</script>
</body>
</html>

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

@ -68,7 +68,7 @@
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:edit')}]];
var prepareMaterialFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:prepareMaterial')}]];
var warehouseOutStatusDatas = [[${@dict.getType('warehouse_out_status')}]];
var warehouseOrderTypeDatas = [[${@dict.getType('warehouse_order_type')}]];
@ -172,13 +172,21 @@
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
if (row.warehouseOutStatus == 0 && row.warehouseOrderType == 0 && row.warehouseOutType == 0){
actions.push('<a class="btn btn-success btn-xs ' + prepareMaterialFlag + '" href="javascript:void(0)" onclick="prepareMaterial(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>准备物料</a> ');
}
return actions.join('');
}
}]
};
$.table.init(options);
});
/*销售单-准备物料*/
function prepareMaterial(outOrderId){
var url = ctx + 'warehouse/warehouseOutOrder/prepareMaterial/' + outOrderId;
$.modal.open("准备物料",url);
}
</script>
</body>
</html>
Loading…
Cancel
Save