Browse Source

[feat]采购管理

采购计划前端页面新增详情按钮和方法
新增采购计划详情页面
采购计划后端接口新增打开采购计划详情页面;保存采购计划详情;采购计划详情页面物料接口
新增 通过采购计划单号查询采购计划详情列表后端方法
新增 采购计划通用保存方法
新增 通过采购计划单号查询采购计划子表数据方法
dev
liuxiaoxu 3 months ago
parent
commit
72629e47ac
  1. 50
      ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java
  2. 9
      ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchasePlanChildMapper.java
  3. 9
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanChildService.java
  4. 5
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanService.java
  5. 10
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanChildServiceImpl.java
  6. 7
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java
  7. 5
      ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml
  8. 95
      ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/detail.html
  9. 9
      ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html

50
ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java

@ -120,6 +120,49 @@ public class PurchasePlanController extends BaseController
/**
* 打开采购计划详情页面
*/
@GetMapping("/detail/{purchasePlanId}")
public String detail(@PathVariable("purchasePlanId") Long purchasePlanId, ModelMap mmap)
{
PurchasePlan purchasePlan = purchasePlanService.selectPurchasePlanById(purchasePlanId);
mmap.put("purchasePlan", purchasePlan);
return prefix + "/detail";
}
/**
* 保存采购计划详情
*
* */
@PostMapping("/detail")
@ResponseBody
public AjaxResult detailSave(PurchasePlan purchasePlan)
{
return toAjax(purchasePlanService.detailSave(purchasePlan));
}
/**
* 采购计划详情页面物料
*
* */
@PostMapping("/purchasePlanDetailList")
@ResponseBody
public TableDataInfo purchasePlanDetailList(PurchasePlan purchasePlan)
{
startPage();
List<PurchasePlanChild> purchasePlanChildList = purchasePlanChildService.selectPurchasePlanChildListByPlanCode(purchasePlan.getPurchasePlanCode());
return getDataTable(purchasePlanChildList);
}
/**
*
* 加载添加采购订单页面
@ -181,13 +224,6 @@ public class PurchasePlanController extends BaseController
return getDataTable(list);
}
@GetMapping("/detail/{purchasePlanId}")
public String detail(@PathVariable("purchasePlanId") Long purchasePlanId, ModelMap mmap)
{
PurchasePlan purchasePlan = purchasePlanService.selectPurchasePlanById(purchasePlanId);
mmap.put("purchasePlan", purchasePlan);
return prefix + "/detail";
}
/**
* 修改保存采购计划单
*/

9
ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchasePlanChildMapper.java

@ -28,6 +28,13 @@ public interface PurchasePlanChildMapper
*/
public List<PurchasePlanChild> selectPurchasePlanChildList(PurchasePlanChild purchasePlanChild);
/*
*
* 通过采购计划单号查询采购计划子表数据
* */
List<PurchasePlanChild> selectPurchasePlanChildListByPlanCode(String purchasePlanCode);
/**
* 新增采购计划单物料信息
*
@ -107,4 +114,6 @@ public interface PurchasePlanChildMapper
* 通过采购计划子表ID集合查询采购计划子表数据
* */
List<PurchasePlanChild> selectBatchPurchasePlanChildByIdList(List<Long> collectPurchasePlanChildId);
}

9
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanChildService.java

@ -27,6 +27,13 @@ public interface IPurchasePlanChildService
*/
public List<PurchasePlanChild> selectPurchasePlanChildList(PurchasePlanChild purchasePlanChild);
/**
* 通过采购计划单号查询采购计划详情列表
* */
List<PurchasePlanChild> selectPurchasePlanChildListByPlanCode(String purchasePlanCode);
/**
* 新增采购计划单物料信息
*
@ -81,4 +88,6 @@ public interface IPurchasePlanChildService
List<PurchasePlanChild> selectPurchasePlanChildListByPlanCodes(String purchasePlanCodes);
List<PurchasePlanChild> getPurchasePlanChildByPlanCodes(String purchaseplanCodes);
}

5
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanService.java

@ -109,4 +109,9 @@ public interface IPurchasePlanService
* 添加采购订单第二步展示选物料列表
* */
List<PurchasePlanChild> selectMaterialTwoList(PurchasePlan purchasePlan);
/**
* 采购计划通用保存
* */
int detailSave(PurchasePlan purchasePlan);
}

10
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanChildServiceImpl.java

@ -46,6 +46,16 @@ public class PurchasePlanChildServiceImpl implements IPurchasePlanChildService
return purchasePlanChildMapper.selectPurchasePlanChildList(purchasePlanChild);
}
/**
* 通过采购计划单号查询采购计划详情列表
* */
@Override
public List<PurchasePlanChild> selectPurchasePlanChildListByPlanCode(String purchasePlanCode) {
return purchasePlanChildMapper.selectPurchasePlanChildListByPlanCode(purchasePlanCode);
}
/**
* 新增采购计划单物料信息
*

7
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java

@ -637,4 +637,11 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService
return purchasePlan;
}
/**
* 采购计划通用保存
* */
@Override
public int detailSave(PurchasePlan purchasePlan) {
return 1;
}
}

5
ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml

@ -72,6 +72,11 @@
</foreach>
</select>
<select id="selectPurchasePlanChildListByPlanCode" parameterType="String" resultMap="PurchasePlanChildResult">
<include refid="selectPurchasePlanChildVo"/>
where purchase_plan_code = #{purchasePlanCode}
</select>
<insert id="insertPurchasePlanChild" parameterType="PurchasePlanChild" useGeneratedKeys="true" keyProperty="purchasePlanChildId">
insert into purchase_plan_child
<trim prefix="(" suffix=")" suffixOverrides=",">

95
ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/detail.html

@ -5,12 +5,12 @@
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-plan-edit" th:object="${purchasePlan}">
<form class="form-horizontal m" id="form-plan-detail" th:object="${purchasePlan}">
<input name="purchasePlanId" th:field="*{purchasePlanId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">采购计划单号:</label>
<div class="col-sm-8">
<input id="detail_purchasePlanCode" name="purchasePlanCode" th:field="*{purchasePlanCode}" class="form-control" type="text" readonly>
<input id="purchasePlanCode" name="purchasePlanCode" th:field="*{purchasePlanCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
@ -30,7 +30,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">采购来源:</label>
<div class="col-sm-8">
<select name="purchasePlanType" class="form-control m-b" th:with="type=${@dict.getType('purchase_plan_source')}" readonly>
<select name="purchasePlanType" class="form-control m-b" th:with="type=${@dict.getType('purchase_plan_type')}" readonly>
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{purchasePlanType}"></option>
</select>
@ -39,13 +39,13 @@
<div class="form-group">
<label class="col-sm-3 control-label">物料合计:</label>
<div class="col-sm-8">
<input name="materialAmount" th:field="*{materialAmount}" class="form-control" type="text" readonly>
<input name="materialSum" th:field="*{materialSum}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">数量总计:</label>
<label class="col-sm-3 control-label">划采购总数</label>
<div class="col-sm-8">
<input name="materialSum" th:field="*{materialSum}" class="form-control" type="text" readonly>
<input name="planPurchaseSum" th:field="*{planPurchaseSum}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
@ -62,17 +62,9 @@
</div>
</form>
<div class="container">
<div class="form-row">
<div class="btn-group-sm" id="toolbar" role="group">
<span>选择报价信息</span>
<a class="btn btn-success" onclick="insertRow()" disabled="">
<i class="fa fa-plus"></i> 添加物料
</a>
</div>
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-sub-table-purchasePlanChild"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>
@ -80,10 +72,10 @@
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "purchase/purchasePlan";
var editFlag = [[${@permission.hasPermi('purchase:plan:edit')}]];
var removeFlag = [[${@permission.hasPermi('purchase:plan:remove')}]];
var cancelFlag = [[${@permission.hasPermi('purchase:plan:cancel')}]];
var restoreFlag = [[${@permission.hasPermi('purchase:plan:restore')}]];
var purchasePlanStatusDatas = [[${@dict.getType('purchase_plan_status')}]];
var auditStatusDatas = [[${@dict.getType('auditStatus')}]];
var useStatusDatas = [[${@dict.getType('useStatus')}]];
@ -91,42 +83,63 @@
var sysUnitClassDatas = [[${@dict.getType('sysUnitClassDatas')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var purchasePlanTypeDatas = [[${@dict.getType('purchase_plan_source')}]];
$("#form-plan-edit").validate({focusCleanup: true});
$("#form-plan-detail").validate({focusCleanup: true});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/detail", $('#form-plan-detail').serialize());
}
}
$(function(){
var option = {
id:'bootstrap-sub-table-purchasePlanChild',
url: ctx + "purchase/purchasePlanChild/list",
method: 'post',
sidePagination: "server",
contentType: "application/x-www-form-urlencoded",
queryParams : function (params){
var temp = {
purchasePlanCode: $("#detail_purchasePlanCode").val()
}
return temp;
},
url: prefix + "/purchasePlanDetailList",
queryParams: queryParams,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns:false,
modalName: "选择物料",
columns: [
{field: 'purchasePlanId',title: '主键id',visible: false},
{field: 'materialCode',title: '料号',},
{field: 'photoUrl',title: '图片',
{field: 'purchasePlanChildId',title: '主键id',visible: false},
{title: '采购计划状态',field: 'purchasePlanStatus',
formatter: function(value, row, index) {return $.table.selectDictLabel(purchasePlanStatusDatas, value);}
},
{field: 'materialNo',title: '料号',},
{field: 'materialPhotourl',title: '图片',
formatter: function(value, row, index) {return $.table.imageView(value);}
},
{field: 'materialName',title: '物料名称',},
{field: 'materialType',title: '物料类型',
formatter: function(value, row, index) {return $.table.selectCategoryLabel(materialTypeDatas, value);}
},
{field: 'describe',title: '描述',},
{field: 'brand',title: '品牌',},
{field: 'processMethod',title: '加工方式',
{field: 'materialDescribe',title: '描述',},
{field: 'materialModel',title: '型号',},
{field: 'materialBrand',title: '品牌',},
{field: 'materialProcessMethod',title: '加工方式',
formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);}
},
{field: 'unit',title: '单位',
},
{field: 'materialNum',title: '计划采购数',
},
{field: 'materialUnit',title: '单位', },
{title: '计划采购数',field: 'planPurchaseNum',},
{title: '待采购数',field: 'purchaseNum',},
{title: '实际采购数',field: 'actualPurchaseNum',},
{title: '共享库存占用数',field: 'sharedInventoryOccupancyNum',},
{title: '作废数',field: 'cancelNum',},
{title: '不含税总价(RMB)',field: 'materialNoRmbSum',},
{title: '含税总价(RMB)',field: 'materialRmbSum',},
{field: 'warehouseDept',title: '入库部门',visible: false},
]}
$.table.init(option);
});
function queryParams(params) {
var curParams = {
purchasePlanCode: $("#purchasePlanCode").val(),
};
return curParams;
}
</script>
</body>

9
ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html

@ -113,8 +113,7 @@
{title: '操作',align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class=" ' +
editFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.purchasePlanId + '\')"><i class="fa fa-edit"></i>详情</a> ');
actions.push('<a href="javascript:void(0)" onclick="detail(\'' + row.purchasePlanId + '\')"><i class="fa fa-edit"></i>详情</a> ');
var actionLinks = actions.join('');
return $.table.dropdownToggle(actionLinks);
}
@ -212,6 +211,12 @@
});
}
//详情
function detail(purchasePlanId) {
var url = prefix + "/detail/" + purchasePlanId;
$.modal.open("采购计划详情", url);
}
</script>
</body>
</html>
Loading…
Cancel
Save