物料新增操作添加选择物料需求
This commit is contained in:
parent
0230110bae
commit
1ed7a8b323
|
|
@ -1,18 +1,13 @@
|
|||
package com.ruoyi.busi.controller;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
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.busi.domain.BusiProductRequire;
|
||||
|
|
@ -135,4 +130,16 @@ public class BusiProductRequireController extends BaseController
|
|||
{
|
||||
return toAjax(busiProductRequireService.deleteBusiProductRequireByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过订单ID查询产品需求列表
|
||||
*/
|
||||
@PostMapping("/listByOrderId")
|
||||
@ResponseBody
|
||||
public AjaxResult list(@RequestParam(name = "orderId",required = false) String orderId)
|
||||
{
|
||||
List<Map<String,String>> list = busiProductRequireService.selectMaterialRequireByOrderId(orderId);
|
||||
return success(list);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.ruoyi.busi.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ruoyi.busi.domain.BusiProductRequire;
|
||||
import com.ruoyi.busi.domain.BusiMaterialRequire;
|
||||
|
||||
|
|
@ -84,4 +86,12 @@ public interface BusiProductRequireMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteBusiMaterialRequireByProductRequireId(String id);
|
||||
|
||||
/**
|
||||
* 通过订单ID查询物料需求列表
|
||||
*
|
||||
* @param orderId 订单ID
|
||||
* @return 结果
|
||||
*/
|
||||
List<Map<String, String>> selectMaterialRequireByOrderId(String orderId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.ruoyi.busi.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ruoyi.busi.domain.BusiProductRequire;
|
||||
|
||||
/**
|
||||
|
|
@ -58,4 +60,12 @@ public interface IBusiProductRequireService
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteBusiProductRequireById(String id);
|
||||
|
||||
/**
|
||||
* 按订单查询物料需求
|
||||
*
|
||||
* @param id 产品需求主键
|
||||
* @return 结果
|
||||
*/
|
||||
public List<Map<String,String>> selectMaterialRequireByOrderId(String orderId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import com.ruoyi.common.utils.DateUtils;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.ruoyi.busi.domain.BusiMaterialRequire;
|
||||
|
|
@ -108,6 +110,11 @@ public class BusiProductRequireServiceImpl implements IBusiProductRequireService
|
|||
return busiProductRequireMapper.deleteBusiProductRequireById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> selectMaterialRequireByOrderId(String orderId) {
|
||||
return busiProductRequireMapper.selectMaterialRequireByOrderId(orderId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增物料需求信息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -130,4 +130,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="selectMaterialRequireByOrderId" parameterType="String" resultType="java.util.Map">
|
||||
select max(A.classify) classifyCode,max(sdd2.dict_label) classifyVal, max(A.color) colorCode, max(sdd.dict_label) colorVal,sum(A.amount) amount, MAX(sdd3.dict_label) unitVal
|
||||
from busi_material_require A
|
||||
left join busi_product_require B on A.product_require_id = B.id
|
||||
left join busi_order bo on B.order_id = bo.id
|
||||
left join sys_dict_data sdd on sdd.dict_type='busi_color' and A.color = sdd.dict_value
|
||||
left join sys_dict_data sdd2 on sdd2.dict_type='busi_material_type' and A.classify = sdd2.dict_value
|
||||
left join sys_dict_data sdd3 on sdd3.dict_type='busi_material_unit' and A.unit = sdd3.dict_value
|
||||
where B.order_id = #{orderId} group by (A.color + A.classify)
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('新增物料操作流水')" />
|
||||
<th:block th:include="include :: header('新增物料操作')" />
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
|
|
@ -14,16 +14,19 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">物料选择:</label>
|
||||
<label class="col-sm-3 control-label" title="若无对应的物料选项,请先在产品需求中添加物料需求">物料选择:<i class="fa fa-question-circle-o"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<input name="materialStockId" class="form-control" type="text">
|
||||
<select id="post" class="form-control required" >
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">数量:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="col-sm-6">
|
||||
<input name="amount" class="form-control" type="text" required>
|
||||
</div>
|
||||
<label class="control-label text-danger">需求量:<span id="requireAmount" class=""> -- </span></label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">操作类型:</label>
|
||||
|
|
@ -50,6 +53,10 @@
|
|||
focusCleanup: true
|
||||
});
|
||||
|
||||
$("#post").change(function(){
|
||||
$("#requireAmount").empty().append($("#post :selected").attr("requireAmount"));
|
||||
})
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/add", $('#form-materialperate-add').serialize());
|
||||
|
|
@ -60,18 +67,41 @@
|
|||
function selectOrder(status) {
|
||||
var options = {
|
||||
title: '选择订单',
|
||||
width: "380",
|
||||
height: "400",
|
||||
width: "480",
|
||||
height: "500",
|
||||
url: ctx + "busi/order/selectOrder/" + status,
|
||||
callBack: function(index, layero){
|
||||
var body = $.modal.getChildFrame(index);
|
||||
$("#treeId").val(body.find('#treeId').val());
|
||||
$("#treeName").val(body.find('#treeName').val());
|
||||
$.modal.close(index);
|
||||
queryMetarial(body.find('#treeId').val());
|
||||
}
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
}
|
||||
|
||||
/*物料查询*/
|
||||
function queryMetarial(orderId) {
|
||||
var url = ctx + "busi/productRequire/listByOrderId?orderId=" + orderId;
|
||||
$.modal.loading("正在查询中,请稍候...");
|
||||
$.post(url, {}, function (result) {
|
||||
var data = result.data;
|
||||
$("#post").empty();
|
||||
$("#post").append("<option value=''>请选择物料</option>");
|
||||
if (result.code == web_status.SUCCESS) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var val = data[i].colorCode + ';' + data[i].classifyCode;
|
||||
var text = data[i].colorVal + ',' + data[i].classifyVal;
|
||||
var requireAmount = data[i].amount + data[i].unitVal;
|
||||
$("#post").append("<option requireAmount='" + requireAmount + "' value='" + val + "'>" + text + "</option>");
|
||||
}
|
||||
} else {
|
||||
$.modal.alertError(result.msg);
|
||||
}
|
||||
$.modal.closeLoading();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -146,10 +146,3 @@ values('物料操作流水删除', @parentId, '4', '#', 'F', '0', 'busi:materi
|
|||
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('物料操作流水导出', @parentId, '5', '#', 'F', '0', 'busi:materialperate:export', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
|
||||
select max(A.classify),max(sdd.dict_label),max(sdd2.dict_label),max(A.color), sum(A.amount) from busi_material_require A
|
||||
left join busi_product_require B on A.product_require_id = B.id
|
||||
left join busi_order bo on B.order_id = bo.id
|
||||
left join sys_dict_data sdd on sdd.dict_type='busi_color' and A.color = sdd.dict_value
|
||||
left join sys_dict_data sdd2 on sdd2.dict_type='busi_material_type' and A.classify = sdd2.dict_value
|
||||
where order_id = 1 group by (A.color + A.classify)
|
||||
Loading…
Reference in New Issue