Browse Source

[feat]仓库管理:

出库单
新增生产单-出库 按钮
新增生产单-出库页面makeOutWarehouse.html
新增生产单-出库后端查询页面接口
新增生产单-出库后端修改保存接口
dev
liuxiaoxu 5 months ago
parent
commit
814844defc
  1. 24
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseOutOrderController.java
  2. 17
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java
  3. 191
      ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/makeOutWarehouse.html
  4. 2
      ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/prepareMaterial.html
  5. 12
      ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/warehouseOutOrder.html

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

@ -190,4 +190,28 @@ public class WarehouseOutOrderController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/**
* 生产单-出库
*/
@GetMapping("/makeOutWarehouse/{outOrderId}")
public String makeOutWarehouse(@PathVariable("outOrderId") Long outOrderId, ModelMap mmap)
{
WarehouseOutOrder warehouseOutOrder = warehouseOutOrderService.selectWarehouseOutOrderById(outOrderId);
mmap.put("warehouseOutOrder", warehouseOutOrder);
return prefix + "/makeOutWarehouse";
}
/**
* 修改保存出库单-出库
*/
@RequiresPermissions("warehouse:warehouseOutOrder:makeOutWarehouse")
@Log(title = "仓库出库单", businessType = BusinessType.UPDATE)
@PostMapping("/makeOutWarehouse")
@ResponseBody
public AjaxResult makeOutWarehouseSave(@RequestBody WarehouseOutOrder warehouseOutOrder)
{
return toAjax(warehouseOutOrderService.updatePrepareMaterial(warehouseOutOrder));
}
} }

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

@ -1,5 +1,6 @@
package com.ruoyi.warehouse.service.impl; package com.ruoyi.warehouse.service.impl;
import java.util.Date;
import java.util.List; import java.util.List;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
@ -13,6 +14,7 @@ import com.ruoyi.warehouse.mapper.WarehouseOutOrderMapper;
import com.ruoyi.warehouse.domain.WarehouseOutOrder; import com.ruoyi.warehouse.domain.WarehouseOutOrder;
import com.ruoyi.warehouse.service.IWarehouseOutOrderService; import com.ruoyi.warehouse.service.IWarehouseOutOrderService;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
/** /**
* 仓库出库单Service业务层处理 * 仓库出库单Service业务层处理
@ -135,15 +137,22 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
/** /**
* 修改保存销售单-准备物料 * 修改保存销售单-准备物料
* */ * */
@Transactional
@Override @Override
public int updatePrepareMaterial(WarehouseOutOrder warehouseOutOrder) { public int updatePrepareMaterial(WarehouseOutOrder warehouseOutOrder) {
String loginName = ShiroUtils.getLoginName();
warehouseOutOrder.setUpdateBy(loginName);
warehouseOutOrder.setUpdateTime(new Date());
warehouseOutOrderMapper.updateWarehouseOutOrder(warehouseOutOrder);
List<WarehouseOutOrderDetail> warehouseOutOrderDetailList = warehouseOutOrder.getWarehouseOutOrderDetailList(); List<WarehouseOutOrderDetail> warehouseOutOrderDetailList = warehouseOutOrder.getWarehouseOutOrderDetailList();
if (StringUtils.isEmpty(warehouseOutOrderDetailList)){ if (StringUtils.isEmpty(warehouseOutOrderDetailList)){
log.warn("保存销售单-准备物料,物料列表信息为空:{}",warehouseOutOrder); log.warn("保存销售单-准备物料,物料列表信息为空:{}",warehouseOutOrder);
} }
int updateRows = 0; int updateRows = 0;
for (WarehouseOutOrderDetail warehouseOutOrderDetail : warehouseOutOrderDetailList) { for (WarehouseOutOrderDetail warehouseOutOrderDetail : warehouseOutOrderDetailList) {
warehouseOutOrderDetail.setUpdateBy(loginName);
warehouseOutOrderDetail.setUpdateTime(new Date());
warehouseOutOrderDetail.setRemark(warehouseOutOrder.getRemark()); warehouseOutOrderDetail.setRemark(warehouseOutOrder.getRemark());
//更新数据库记录 //更新数据库记录
updateRows += outOrderDetailMapper.updateWarehouseOutOrderDetail(warehouseOutOrderDetail); updateRows += outOrderDetailMapper.updateWarehouseOutOrderDetail(warehouseOutOrderDetail);
@ -155,15 +164,23 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
/** /**
* 修改保存销售单-出库 * 修改保存销售单-出库
*/ */
@Transactional
@Override @Override
public int updateSalesOutWarehouse(WarehouseOutOrder warehouseOutOrder) { public int updateSalesOutWarehouse(WarehouseOutOrder warehouseOutOrder) {
String loginName = ShiroUtils.getLoginName();
warehouseOutOrder.setUpdateBy(loginName);
warehouseOutOrder.setUpdateTime(new Date());
warehouseOutOrderMapper.updateWarehouseOutOrder(warehouseOutOrder);
List<WarehouseOutOrderDetail> warehouseOutOrderDetailList = warehouseOutOrder.getWarehouseOutOrderDetailList(); List<WarehouseOutOrderDetail> warehouseOutOrderDetailList = warehouseOutOrder.getWarehouseOutOrderDetailList();
if (StringUtils.isEmpty(warehouseOutOrderDetailList)){ if (StringUtils.isEmpty(warehouseOutOrderDetailList)){
log.warn("保存销售单-出库,物料列表信息为空:{}",warehouseOutOrder); log.warn("保存销售单-出库,物料列表信息为空:{}",warehouseOutOrder);
} }
int updateRows = 0; int updateRows = 0;
for (WarehouseOutOrderDetail warehouseOutOrderDetail : warehouseOutOrderDetailList) { for (WarehouseOutOrderDetail warehouseOutOrderDetail : warehouseOutOrderDetailList) {
warehouseOutOrderDetail.setUpdateBy(loginName);
warehouseOutOrderDetail.setUpdateTime(new Date());
warehouseOutOrderDetail.setRemark(warehouseOutOrder.getRemark()); warehouseOutOrderDetail.setRemark(warehouseOutOrder.getRemark());
warehouseOutOrderDetail.setDeliveryDate(warehouseOutOrder.getDeliveryDate()); warehouseOutOrderDetail.setDeliveryDate(warehouseOutOrder.getDeliveryDate());
//更新数据库记录 //更新数据库记录

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

@ -0,0 +1,191 @@
<!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-makeOutWarehouse-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="makeNo" th:field="*{makeNo}" 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="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-makeOutWarehouse-edit").validate({
focusCleanup: true
});
// 新增提交
function submitHandler() {
// 获取表单数据
const warehouseOutOrderData = $("#form-makeOutWarehouse-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,
"actualOutOrderSum":item.actualOutOrderSum
// ...其他字段
};
});
const combinedData = Object.assign({}, warehouseOutOrderData, {
warehouseOutOrderDetailList: materialDataList,
});
// 合并表单数据和表格数据
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/makeOutWarehouse", 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: 'actualOutOrderSum',
editable:true
}
]
};
$.table.init(options);
})
function queryParams(params) {
var curParams = {
// 传递参数查询参数
outOrderCode: warehouseOutOrder.outOrderCode
};
console.log(curParams);
return curParams;
}
</script>
</body>
</html>

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

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head> <head>
<th:block th:include="include :: header('修改仓库出库单')" /> <th:block th:include="include :: header('销售单-准备物料')" />
<th:block th:include="include :: datetimepicker-css" /> <th:block th:include="include :: datetimepicker-css" />
</head> </head>
<body class="white-bg"> <body class="white-bg">

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

@ -70,7 +70,7 @@
var editFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:edit')}]]; var editFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:edit')}]];
var prepareMaterialFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:prepareMaterial')}]]; var prepareMaterialFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:prepareMaterial')}]];
var salesOutWarehouseFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:salesOutWarehouse')}]]; var salesOutWarehouseFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:salesOutWarehouse')}]];
var makeOutWarehouseFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:makeOutWarehouse')}]];
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')}]];
@ -180,6 +180,10 @@
if (row.warehouseOutStatus == 4 && row.warehouseOrderType == 0 && row.warehouseOutType == 0){ if (row.warehouseOutStatus == 4 && row.warehouseOrderType == 0 && row.warehouseOutType == 0){
actions.push('<a class="btn btn-success btn-xs ' + salesOutWarehouseFlag + '" href="javascript:void(0)" onclick="salesOutWarehouse(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>出库</a> '); actions.push('<a class="btn btn-success btn-xs ' + salesOutWarehouseFlag + '" href="javascript:void(0)" onclick="salesOutWarehouse(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>出库</a> ');
} }
if (row.warehouseOutStatus == 4 && row.warehouseOrderType == 1 && row.warehouseOutType == 1){
actions.push('<a class="btn btn-success btn-xs ' + makeOutWarehouseFlag + '" href="javascript:void(0)" onclick="makeOutWarehouse(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>出库</a> ');
}
return actions.join(''); return actions.join('');
} }
}] }]
@ -198,6 +202,12 @@
var url = ctx + 'warehouse/warehouseOutOrder/salesOutWarehouse/' + outOrderId; var url = ctx + 'warehouse/warehouseOutOrder/salesOutWarehouse/' + outOrderId;
$.modal.open("出库",url); $.modal.open("出库",url);
} }
/*生产单-出库*/
function makeOutWarehouse(outOrderId){
var url = ctx + 'warehouse/warehouseOutOrder/makeOutWarehouse/' + outOrderId;
$.modal.open("出库",url);
}
</script> </script>
</body> </body>
</html> </html>
Loading…
Cancel
Save