来料和分料分页面展示,代码优化修改
This commit is contained in:
parent
e2bb23f0ca
commit
e3e16fa568
|
|
@ -70,11 +70,19 @@ public class BusiMaterialOperateController extends BaseController
|
||||||
/**
|
/**
|
||||||
* 新增物料操作流水
|
* 新增物料操作流水
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add")
|
@GetMapping("/addIn")
|
||||||
public String add(@RequestParam(name = "operType",required = false) String operType,ModelMap mmap)
|
public String addIn()
|
||||||
{
|
{
|
||||||
mmap.put("operType",operType);
|
return prefix + "/addIn";
|
||||||
return prefix + "/add";
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增物料操作流水
|
||||||
|
*/
|
||||||
|
@GetMapping("/addOut")
|
||||||
|
public String addOut()
|
||||||
|
{
|
||||||
|
return prefix + "/addOut";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ruoyi.busi.controller;
|
package com.ruoyi.busi.controller;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -131,15 +132,61 @@ public class BusiProductRequireController extends BaseController
|
||||||
return toAjax(busiProductRequireService.deleteBusiProductRequireByIds(ids));
|
return toAjax(busiProductRequireService.deleteBusiProductRequireByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过订单ID查询 物料类型列表
|
||||||
|
*/
|
||||||
|
@PostMapping("/selMaterialTypeListByOrderId")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult selMaterialTypeListByOrderId(@RequestParam(name = "orderId",required = false) String orderId)
|
||||||
|
{
|
||||||
|
List<Map<String,String>> list = busiProductRequireService.selMaterialTypeListByOrderId(orderId);
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过订单ID和物料类型查询 物料颜色列表
|
||||||
|
*/
|
||||||
|
@PostMapping("/selMaterialColorListByOrderIdAndType")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult selMaterialColorListByOrderIdAndType(@RequestParam Map<String,String> queryMap)
|
||||||
|
{
|
||||||
|
List<Map<String,String>> list = busiProductRequireService.selMaterialColorListByOrderIdAndType(queryMap);
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过订单ID查询产品需求列表
|
* 通过订单ID查询产品需求列表
|
||||||
*/
|
*/
|
||||||
@PostMapping("/listByOrderId")
|
@PostMapping("/listByOrderId")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult list(@RequestParam(name = "orderId",required = false) String orderId)
|
public AjaxResult listByOrderId(@RequestParam(name = "orderId", required = false) String orderId) {
|
||||||
|
BusiProductRequire query = new BusiProductRequire();
|
||||||
|
query.setOrderId(orderId);
|
||||||
|
List<BusiProductRequire> list = busiProductRequireService.selectBusiProductRequireList(query);
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过产品ID查询 物料类型列表
|
||||||
|
*/
|
||||||
|
@PostMapping("/selMaterialTypeListByProductId")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult selMaterialTypeListByProductId(@RequestParam(name = "productId",required = false) String productId)
|
||||||
{
|
{
|
||||||
List<Map<String,String>> list = busiProductRequireService.selectMaterialRequireByOrderId(orderId);
|
List<Map<String,String>> list = busiProductRequireService.selMaterialTypeListByProductId(productId);
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过产品ID和查询物料颜色查询物料类型需求列表
|
||||||
|
*/
|
||||||
|
@PostMapping("/materialColorListByProductIdAndType")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult selMaterialColorListByProductIdAndType(@RequestParam Map<String,String> queryMap)
|
||||||
|
{
|
||||||
|
List<Map<String,String>> list = busiProductRequireService.selMaterialColorListByProductIdAndType(queryMap);
|
||||||
return success(list);
|
return success(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物料需求对象 busi_material_require
|
* 物料需求对象 busi_material_require
|
||||||
*
|
*
|
||||||
|
|
@ -24,7 +26,7 @@ public class BusiMaterialRequire extends BaseEntity
|
||||||
|
|
||||||
/** 数量 */
|
/** 数量 */
|
||||||
@Excel(name = "数量")
|
@Excel(name = "数量")
|
||||||
private Long amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
/** 单位 */
|
/** 单位 */
|
||||||
@Excel(name = "单位")
|
@Excel(name = "单位")
|
||||||
|
|
@ -56,15 +58,15 @@ public class BusiMaterialRequire extends BaseEntity
|
||||||
{
|
{
|
||||||
return productRequireId;
|
return productRequireId;
|
||||||
}
|
}
|
||||||
public void setAmount(Long amount)
|
|
||||||
{
|
public BigDecimal getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAmount(BigDecimal amount) {
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getAmount()
|
|
||||||
{
|
|
||||||
return amount;
|
|
||||||
}
|
|
||||||
public void setUnit(String unit)
|
public void setUnit(String unit)
|
||||||
{
|
{
|
||||||
this.unit = unit;
|
this.unit = unit;
|
||||||
|
|
|
||||||
|
|
@ -87,11 +87,11 @@ public interface BusiProductRequireMapper
|
||||||
*/
|
*/
|
||||||
public int deleteBusiMaterialRequireByProductRequireId(String id);
|
public int deleteBusiMaterialRequireByProductRequireId(String id);
|
||||||
|
|
||||||
/**
|
List<Map<String, String>> selMaterialTypeListByOrderId(String orderId);
|
||||||
* 通过订单ID查询物料需求列表
|
|
||||||
*
|
List<Map<String, String>> selMaterialColorListByOrderIdAndType(Map<String, String> queryMap);
|
||||||
* @param orderId 订单ID
|
|
||||||
* @return 结果
|
List<Map<String, String>> selMaterialTypeListByProductId(String productId);
|
||||||
*/
|
|
||||||
List<Map<String, String>> selectMaterialRequireByOrderId(String orderId);
|
List<Map<String, String>> selMaterialColorListByProductIdAndType(Map<String, String> queryMap);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,11 +61,11 @@ public interface IBusiProductRequireService
|
||||||
*/
|
*/
|
||||||
public int deleteBusiProductRequireById(String id);
|
public int deleteBusiProductRequireById(String id);
|
||||||
|
|
||||||
/**
|
List<Map<String, String>> selMaterialTypeListByOrderId(String orderId);
|
||||||
* 按订单查询物料需求
|
|
||||||
*
|
List<Map<String, String>> selMaterialColorListByOrderIdAndType(Map<String, String> queryMap);
|
||||||
* @param id 产品需求主键
|
|
||||||
* @return 结果
|
List<Map<String, String>> selMaterialTypeListByProductId(String productId);
|
||||||
*/
|
|
||||||
public List<Map<String,String>> selectMaterialRequireByOrderId(String orderId);
|
List<Map<String, String>> selMaterialColorListByProductIdAndType(Map<String, String> queryMap);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -111,8 +111,23 @@ public class BusiProductRequireServiceImpl implements IBusiProductRequireService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, String>> selectMaterialRequireByOrderId(String orderId) {
|
public List<Map<String, String>> selMaterialTypeListByOrderId(String orderId) {
|
||||||
return busiProductRequireMapper.selectMaterialRequireByOrderId(orderId);
|
return busiProductRequireMapper.selMaterialTypeListByOrderId(orderId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, String>> selMaterialColorListByOrderIdAndType(Map<String, String> queryMap) {
|
||||||
|
return busiProductRequireMapper.selMaterialColorListByOrderIdAndType(queryMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, String>> selMaterialTypeListByProductId(String productId) {
|
||||||
|
return busiProductRequireMapper.selMaterialTypeListByProductId(productId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, String>> selMaterialColorListByProductIdAndType(Map<String, String> queryMap) {
|
||||||
|
return busiProductRequireMapper.selMaterialColorListByProductIdAndType(queryMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -130,15 +130,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<select id="selMaterialTypeListByOrderId" parameterType="String" resultType="java.util.Map">
|
||||||
<select id="selectMaterialRequireByOrderId" parameterType="String" resultType="java.util.Map">
|
SELECT DISTINCT bmr.classify classifyCode
|
||||||
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, max(A.unit) as unitCode
|
from busi_material_require bmr
|
||||||
from busi_material_require A
|
LEFT JOIN busi_product_require bpr
|
||||||
left join busi_product_require B on A.product_require_id = B.id
|
on bmr.product_require_id = bpr.id
|
||||||
left join busi_order bo on B.order_id = bo.id
|
where bpr.order_id = #{orderId}
|
||||||
left join sys_dict_data sdd on sdd.dict_type='busi_color' and A.color = sdd.dict_value
|
</select>
|
||||||
left join sys_dict_data sdd2 on sdd2.dict_type='busi_material_type' and A.classify = sdd2.dict_value
|
<select id="selMaterialColorListByOrderIdAndType" parameterType="java.util.Map" resultType="java.util.Map">
|
||||||
left join sys_dict_data sdd3 on sdd3.dict_type='busi_material_unit' and A.unit = sdd3.dict_value
|
SELECT DISTINCT bmr.color AS colorCode
|
||||||
where B.order_id = #{orderId} group by (A.color + A.classify)
|
FROM busi_material_require bmr
|
||||||
|
LEFT JOIN busi_product_require bpr
|
||||||
|
ON bmr.product_require_id = bpr.id
|
||||||
|
WHERE bpr.order_id = #{orderId} AND bmr.classify = #{classify}
|
||||||
|
</select>
|
||||||
|
<select id="selMaterialTypeListByProductId" parameterType="String" resultType="java.util.Map">
|
||||||
|
SELECT DISTINCT bmr.classify AS classifyCode
|
||||||
|
FROM busi_material_require bmr
|
||||||
|
WHERE bmr.product_require_id = #{productId}
|
||||||
|
</select>
|
||||||
|
<select id="selMaterialColorListByProductIdAndType" parameterType="java.util.Map" resultType="java.util.Map">
|
||||||
|
SELECT DISTINCT bmr.color AS colorCode
|
||||||
|
FROM busi_material_require bmr
|
||||||
|
WHERE bmr.product_require_id = #{productId} AND bmr.classify = #{classify}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -525,6 +525,20 @@ var table = {
|
||||||
}
|
}
|
||||||
return distinct ? $.common.uniqueFn(rows) : rows;
|
return distinct ? $.common.uniqueFn(rows) : rows;
|
||||||
},
|
},
|
||||||
|
// 返回数据字典显示值
|
||||||
|
getDictText: function(datas, value) {
|
||||||
|
if ($.common.isEmpty(datas) || $.common.isEmpty(value)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
var actions = [];
|
||||||
|
$.each(datas, function(index, dict) {
|
||||||
|
if (dict.dictValue == ('' + value)) {
|
||||||
|
actions.push(dict.dictLabel);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return actions.join('');
|
||||||
|
},
|
||||||
// 回显数据字典
|
// 回显数据字典
|
||||||
selectDictLabel: function(datas, value) {
|
selectDictLabel: function(datas, value) {
|
||||||
if ($.common.isEmpty(datas) || $.common.isEmpty(value)) {
|
if ($.common.isEmpty(datas) || $.common.isEmpty(value)) {
|
||||||
|
|
|
||||||
|
|
@ -1,113 +1,134 @@
|
||||||
<!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('新增来料')" />
|
||||||
</head>
|
</head>
|
||||||
<body class="white-bg">
|
<body class="white-bg">
|
||||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
<form class="form-horizontal m" id="form-materialperate-add">
|
<form class="form-horizontal m" id="form-materialperate-add">
|
||||||
<div class="form-group">
|
<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">
|
<div class="col-sm-8">
|
||||||
<input id="treeId" name="orderId" type="hidden">
|
<input id="treeId" name="orderId" type="hidden">
|
||||||
<input id="treeName" name="orderName" readonly="true" onclick="selectOrder(1)" class="form-control" type="text" required>
|
<input id="treeName" name="orderName" readonly="true" onclick="selectOrder(1)" class="form-control" type="text" required>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
</div>
|
||||||
<label class="col-sm-3 control-label" title="若无对应的物料选项,请先在产品需求中添加物料需求">物料选择:<i class="fa fa-question-circle-o"></i></label>
|
<div class="form-group">
|
||||||
<div class="col-sm-6">
|
<label class="col-sm-3 control-label" title="若无对应的物料选项,请先在产品需求中添加物料需求">物料选择:<i class="fa fa-question-circle-o"></i></label>
|
||||||
<select id="post" name="colorAndType" class="form-control required" >
|
<div class="col-sm-3">
|
||||||
</select>
|
<select id="classify" name="classify" class="form-control required" >
|
||||||
</div>
|
</select>
|
||||||
<label class="control-label text-danger">需求量:<span id="requireAmount" class=""> -- </span></label>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="col-sm-3">
|
||||||
<label class="col-sm-3 control-label is-required">数量:</label>
|
<select id="color" name="color" class="form-control required" >
|
||||||
<div class="col-sm-6">
|
</select>
|
||||||
<input name="amount" class="form-control" type="text" required>
|
|
||||||
</div>
|
|
||||||
<label class="control-label text-danger">库存量:<span id="requireAmount" class=""> -- </span></label>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" th:style="${operType==null}?'':'display:none'">
|
<label class="control-label text-danger">需求量:<span id="requireAmount" class=""> -- </span></label>
|
||||||
<label class="col-sm-3 control-label">操作类型:</label>
|
</div>
|
||||||
<div class="col-sm-8">
|
<div class="form-group">
|
||||||
<select name="oprateType" class="form-control m-b">
|
<label class="col-sm-3 control-label is-required">来料数量:</label>
|
||||||
<option value="1" th:selected="${operType ne '2'}">入库</option>
|
<div class="col-sm-6">
|
||||||
<option value="2" th:selected="${operType eq '2'}">出库</option>
|
<input name="amount" class="form-control" type="text" required>
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<label class="control-label text-danger">当前库存量:<span id="requireAmount" class=""> -- </span></label>
|
||||||
<label class="col-sm-3 control-label">备注信息:</label>
|
</div>
|
||||||
<div class="col-sm-8">
|
<div class="form-group" th:style="${operType==null}?'':'display:none'">
|
||||||
<textarea name="remark" class="form-control"></textarea>
|
<label class="col-sm-3 control-label">操作类型:</label>
|
||||||
</div>
|
<div class="col-sm-8">
|
||||||
|
<select name="oprateType" class="form-control m-b">
|
||||||
|
<option value="1" th:selected="${operType ne '2'}">入库</option>
|
||||||
|
<option value="2" th:selected="${operType eq '2'}">出库</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">备注信息:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<textarea name="remark" class="form-control"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group" th:if="${operType!=null}">
|
<div class="form-group" th:if="${operType!=null}">
|
||||||
<div class="col-sm-5"></div>
|
<div class="col-sm-5"></div>
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
<a class="btn btn-success" onclick="submitHandler()" >
|
<a class="btn btn-success" onclick="submitHandler()" >
|
||||||
保存
|
保存
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
<a class="btn btn-info" onclick="$.modal.closeTab()" >
|
<a class="btn btn-info" onclick="$.modal.closeTab()" >
|
||||||
关闭
|
关闭
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<th:block th:include="include :: footer" />
|
<th:block th:include="include :: footer" />
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
var prefix = ctx + "busi/materialperate"
|
var prefix = ctx + "busi/materialperate"
|
||||||
$("#form-materialperate-add").validate({
|
$("#form-materialperate-add").validate({
|
||||||
focusCleanup: true
|
focusCleanup: true
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#post").change(function(){
|
$("#classify").change(function(){
|
||||||
$("#requireAmount").empty().append($("#post :selected").attr("requireAmount"));
|
var orderId = $("#treeId").val();
|
||||||
})
|
var classify = $("#classify").val();
|
||||||
|
queryColorList(orderId, classify);
|
||||||
|
})
|
||||||
|
|
||||||
function submitHandler() {
|
function submitHandler() {
|
||||||
if ($.validate.form()) {
|
if ($.validate.form()) {
|
||||||
$.operate.save(prefix + "/add", $('#form-materialperate-add').serialize());
|
$.operate.save(prefix + "/add", $('#form-materialperate-add').serialize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*订单选择*/
|
||||||
|
function selectOrder(status) {
|
||||||
|
var options = {
|
||||||
|
title: '选择订单',
|
||||||
|
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);
|
||||||
|
queryClassifyList(body.find('#treeId').val());
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
$.modal.openOptions(options);
|
||||||
|
}
|
||||||
|
|
||||||
/*订单选择*/
|
/*物料需求类型查询*/
|
||||||
function selectOrder(status) {
|
function queryClassifyList(orderId) {
|
||||||
var options = {
|
var url = ctx + "busi/productRequire/selMaterialTypeListByOrderId?orderId=" + orderId;
|
||||||
title: '选择订单',
|
$.operate.ajaxPost(url, {}, function (result) {
|
||||||
width: "480",
|
var data = result.data;
|
||||||
height: "500",
|
$("#classify").empty().append("<option value=''>请选择物料</option>");
|
||||||
url: ctx + "busi/order/selectOrder/" + status,
|
for (var i = 0; i < data.length; i++) {
|
||||||
callBack: function(index, layero){
|
var val = data[i].classifyCode;
|
||||||
var body = $.modal.getChildFrame(index);
|
var text = data[i].classifyText;
|
||||||
$("#treeId").val(body.find('#treeId').val());
|
$("#classify").append("<option value='" + val + "'>" + text + "</option>");
|
||||||
$("#treeName").val(body.find('#treeName').val());
|
}
|
||||||
$.modal.close(index);
|
})
|
||||||
queryMetarial(body.find('#treeId').val());
|
}
|
||||||
}
|
|
||||||
};
|
|
||||||
$.modal.openOptions(options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*物料需求查询*/
|
/*物料需求颜色查询*/
|
||||||
function queryMetarial(orderId) {
|
function queryColorList(orderId, classify) {
|
||||||
var url = ctx + "busi/productRequire/listByOrderId?orderId=" + orderId;
|
var url = ctx + "busi/productRequire/selMaterialColorListByOrderIdAndType";
|
||||||
$.operate.ajaxPost(url, {}, function (result) {
|
$.operate.ajaxPost(url, {
|
||||||
var data = result.data;
|
orderId:orderId,
|
||||||
$("#post").empty();
|
classify:classify
|
||||||
$("#post").append("<option value=''>请选择物料</option>");
|
}, function (result) {
|
||||||
for (var i = 0; i < data.length; i++) {
|
var data = result.data;
|
||||||
var val = data[i].colorCode + ';' + data[i].classifyCode + ';' + data[i].unitCode;
|
$("#color").empty().append("<option value=''>请选择颜色</option>");
|
||||||
var text = data[i].colorVal + ',' + data[i].classifyVal;
|
for (var i = 0; i < data.length; i++) {
|
||||||
var requireAmount = data[i].amount + data[i].unitVal;
|
var val = data[i].colorCode;
|
||||||
$("#post").append("<option requireAmount='" + requireAmount + "' value='" + val + "'>" + text + "</option>");
|
var text = data[i].colorText;
|
||||||
}
|
$("#color").append("<option value='" + val + "'>" + text + "</option>");
|
||||||
})
|
}
|
||||||
}
|
})
|
||||||
</script>
|
}
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -0,0 +1,141 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||||
|
<head>
|
||||||
|
<th:block th:include="include :: header('新增来料')" />
|
||||||
|
</head>
|
||||||
|
<body class="white-bg">
|
||||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
|
<form class="form-horizontal m" id="form-materialperate-add">
|
||||||
|
<input name="oprateType" type="hidden" value="1">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">订单:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input id="treeId" name="orderId" type="hidden">
|
||||||
|
<input id="treeName" name="orderName" readonly="true" onclick="selectOrder(1)" class="form-control" type="text" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label" title="若无对应的物料选项,请先在产品需求中添加物料需求">物料选择:<i class="fa fa-question-circle-o"></i></label>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<select id="classify" name="classify" class="form-control required" >
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<select id="color" name="color" class="form-control required" >
|
||||||
|
</select>
|
||||||
|
</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 is-required">来料数量:</label>
|
||||||
|
<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" th:style="${operType==null}?'':'display:none'">-->
|
||||||
|
<!-- <label class="col-sm-3 control-label">操作类型:</label>-->
|
||||||
|
<!-- <div class="col-sm-8">-->
|
||||||
|
<!-- <select name="oprateType" class="form-control m-b">-->
|
||||||
|
<!-- <option value="1" th:selected="${operType ne '2'}">入库</option>-->
|
||||||
|
<!-- <option value="2" th:selected="${operType eq '2'}">出库</option>-->
|
||||||
|
<!-- </select>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">备注信息:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<textarea name="remark" class="form-control"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group" th:if="${operType!=null}">
|
||||||
|
<div class="col-sm-5"></div>
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<a class="btn btn-success" onclick="submitHandler()" >
|
||||||
|
保存
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<a class="btn btn-info" onclick="$.modal.closeTab()" >
|
||||||
|
关闭
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<th:block th:include="include :: footer" />
|
||||||
|
<script th:inline="javascript">
|
||||||
|
var prefix = ctx + "busi/materialperate";
|
||||||
|
var colorDatas = [[${@dict.getType('busi_color')}]];
|
||||||
|
var sizeDatas = [[${@dict.getType('busi_size')}]];
|
||||||
|
var classifyDatas = [[${@dict.getType('busi_material_type')}]];
|
||||||
|
|
||||||
|
$("#form-materialperate-add").validate({
|
||||||
|
focusCleanup: true
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#classify").change(function(){
|
||||||
|
var orderId = $("#treeId").val();
|
||||||
|
var classify = $("#classify").val();
|
||||||
|
queryColorList(orderId, classify);
|
||||||
|
})
|
||||||
|
|
||||||
|
function submitHandler() {
|
||||||
|
if ($.validate.form()) {
|
||||||
|
$.operate.save(prefix + "/add", $('#form-materialperate-add').serialize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*订单选择*/
|
||||||
|
function selectOrder(status) {
|
||||||
|
var options = {
|
||||||
|
title: '选择订单',
|
||||||
|
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);
|
||||||
|
queryClassifyList(body.find('#treeId').val());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$.modal.openOptions(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*物料需求类型查询*/
|
||||||
|
function queryClassifyList(orderId) {
|
||||||
|
var url = ctx + "busi/productRequire/selMaterialTypeListByOrderId?orderId=" + orderId;
|
||||||
|
$.operate.ajaxPost(url, {}, function (result) {
|
||||||
|
var data = result.data;
|
||||||
|
$("#color").empty();
|
||||||
|
$("#classify").empty().append("<option value=''>请选择物料</option>");
|
||||||
|
for (var i = 0; i < data.length; i++) {
|
||||||
|
var val = data[i].classifyCode;
|
||||||
|
var text = $.table.getDictText(classifyDatas, val);
|
||||||
|
$("#classify").append("<option value='" + val + "'>" + text + "</option>");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/*物料需求颜色查询*/
|
||||||
|
function queryColorList(orderId, classify) {
|
||||||
|
var url = ctx + "busi/productRequire/selMaterialColorListByOrderIdAndType";
|
||||||
|
$.operate.ajaxPost(url, {
|
||||||
|
orderId:orderId,
|
||||||
|
classify:classify
|
||||||
|
}, function (result) {
|
||||||
|
var data = result.data;
|
||||||
|
$("#color").empty().append("<option value=''>请选择颜色</option>");
|
||||||
|
for (var i = 0; i < data.length; i++) {
|
||||||
|
var val = data[i].colorCode;
|
||||||
|
var text = $.table.getDictText(colorDatas, val);;
|
||||||
|
$("#color").append("<option value='" + val + "'>" + text + "</option>");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,154 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||||
|
<head>
|
||||||
|
<th:block th:include="include :: header('新增分料')" />
|
||||||
|
</head>
|
||||||
|
<body class="white-bg">
|
||||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
|
<form class="form-horizontal m" id="form-materialperate-add">
|
||||||
|
<input name="oprateType" type="hidden" value="1">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">订单:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input id="treeId" name="orderId" type="hidden">
|
||||||
|
<input id="treeName" name="orderName" readonly="true" onclick="selectOrder(1)" class="form-control" type="text" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">产品:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<select id="product" class="form-control" >
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label" title="若无对应的物料选项,请先添加来料">物料选择:<i class="fa fa-question-circle-o"></i></label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<select id="classify" name="classify" class="form-control required" >
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<select id="color" name="color" 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-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>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<textarea name="remark" class="form-control"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group" th:if="${operType!=null}">
|
||||||
|
<div class="col-sm-5"></div>
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<a class="btn btn-success" onclick="submitHandler()" >
|
||||||
|
保存
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<a class="btn btn-info" onclick="$.modal.closeTab()" >
|
||||||
|
关闭
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<th:block th:include="include :: footer" />
|
||||||
|
<script th:inline="javascript">
|
||||||
|
var prefix = ctx + "busi/materialperate"
|
||||||
|
var colorDatas = [[${@dict.getType('busi_color')}]];
|
||||||
|
var sizeDatas = [[${@dict.getType('busi_size')}]];
|
||||||
|
var classifyDatas = [[${@dict.getType('busi_material_type')}]];
|
||||||
|
|
||||||
|
$("#form-materialperate-add").validate({
|
||||||
|
focusCleanup: true
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#product").change(function(){
|
||||||
|
queryClassifyList($("#product").val());
|
||||||
|
})
|
||||||
|
|
||||||
|
$("#classify").change(function(){
|
||||||
|
queryColorList($("#product").val(), $("#classify").val());
|
||||||
|
})
|
||||||
|
|
||||||
|
function submitHandler() {
|
||||||
|
if ($.validate.form()) {
|
||||||
|
$.operate.save(prefix + "/add", $('#form-materialperate-add').serialize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*订单选择*/
|
||||||
|
function selectOrder(status) {
|
||||||
|
var options = {
|
||||||
|
title: '选择订单',
|
||||||
|
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);
|
||||||
|
queryProductList(body.find('#treeId').val());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$.modal.openOptions(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*产品需求查询*/
|
||||||
|
function queryProductList(orderId) {
|
||||||
|
var url = ctx + "busi/productRequire/listByOrderId?orderId=" + orderId;
|
||||||
|
$.operate.ajaxPost(url, {}, function (result) {
|
||||||
|
var data = result.data;
|
||||||
|
$("#color,#classify").empty();
|
||||||
|
$("#product").empty().append("<option value=''>请选择产品</option>");
|
||||||
|
for (var i = 0; i < data.length; i++) {
|
||||||
|
var val = data[i].id;
|
||||||
|
var text = $.table.getDictText(colorDatas, data[i].color) + "," + $.table.getDictText(sizeDatas, data[i].size);
|
||||||
|
$("#product").append("<option value='" + val + "'>" + text + "</option>");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/*物料需求类型查询*/
|
||||||
|
function queryClassifyList(productId) {
|
||||||
|
var url = ctx + "busi/productRequire/selMaterialTypeListByProductId?productId=" + productId;
|
||||||
|
$.operate.ajaxPost(url, {}, function (result) {
|
||||||
|
var data = result.data;
|
||||||
|
$("#color").empty();
|
||||||
|
$("#classify").empty().append("<option value=''>请选择物料</option>");
|
||||||
|
for (var i = 0; i < data.length; i++) {
|
||||||
|
var val = data[i].classifyCode;
|
||||||
|
var text = $.table.getDictText(classifyDatas, val);
|
||||||
|
$("#classify").append("<option value='" + val + "'>" + text + "</option>");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/*物料需求颜色查询*/
|
||||||
|
function queryColorList(productId, classify) {
|
||||||
|
var url = ctx + "busi/productRequire/materialColorListByProductIdAndType";
|
||||||
|
$.operate.ajaxPost(url, {
|
||||||
|
productId:productId,
|
||||||
|
classify:classify
|
||||||
|
}, function (result) {
|
||||||
|
var data = result.data;
|
||||||
|
$("#color").empty().append("<option value=''>请选择颜色</option>");
|
||||||
|
for (var i = 0; i < data.length; i++) {
|
||||||
|
var val = data[i].colorCode;
|
||||||
|
var text = $.table.getDictText(colorDatas, val);
|
||||||
|
$("#color").append("<option value='" + val + "'>" + text + "</option>");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -43,8 +43,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-group-sm" id="toolbar" role="group">
|
<div class="btn-group-sm" id="toolbar" role="group">
|
||||||
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="busi:materialperate:add">
|
<a class="btn btn-success" onclick="addIn()" shiro:hasPermission="busi:materialperate:add">
|
||||||
<i class="fa fa-plus"></i> 添加
|
<i class="fa fa-plus"></i> 添加来料
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-success" onclick="addOut()" shiro:hasPermission="busi:materialperate:add">
|
||||||
|
<i class="fa fa-minus"></i> 添加分料
|
||||||
</a>
|
</a>
|
||||||
<!-- <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="busi:materialperate:edit">-->
|
<!-- <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="busi:materialperate:edit">-->
|
||||||
<!-- <i class="fa fa-edit"></i> 修改-->
|
<!-- <i class="fa fa-edit"></i> 修改-->
|
||||||
|
|
@ -169,6 +172,14 @@
|
||||||
};
|
};
|
||||||
$.modal.openOptions(options);
|
$.modal.openOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addIn(){
|
||||||
|
$.modal.open("添加来料", prefix + "/addIn");
|
||||||
|
}
|
||||||
|
|
||||||
|
function addOut(){
|
||||||
|
$.modal.open("添加分料", prefix + "/addOut");
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h4 class="form-header h4">物料需求信息</h4>
|
<h4 class="form-header h4">单件产品物料需求</h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i></button>
|
<button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i></button>
|
||||||
|
|
@ -130,7 +130,7 @@
|
||||||
align: 'center',
|
align: 'center',
|
||||||
title: '数量',
|
title: '数量',
|
||||||
formatter: function(value, row, index) {
|
formatter: function(value, row, index) {
|
||||||
var html = $.common.sprintf("<input class='form-control digits required' type='text' name='busiMaterialRequireList[%s].amount' value='%s'>", index, value);
|
var html = $.common.sprintf("<input class='form-control number required' type='text' name='busiMaterialRequireList[%s].amount' value='%s'>", index, value);
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h4 class="form-header h4">物料需求信息</h4>
|
<h4 class="form-header h4">单件产品物料需求</h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i></button>
|
<button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i></button>
|
||||||
|
|
@ -132,7 +132,7 @@
|
||||||
align: 'center',
|
align: 'center',
|
||||||
title: '数量',
|
title: '数量',
|
||||||
formatter: function(value, row, index) {
|
formatter: function(value, row, index) {
|
||||||
var html = $.common.sprintf("<input class='form-control digits required' type='text' name='busiMaterialRequireList[%s].amount' value='%s'>", index, value);
|
var html = $.common.sprintf("<input class='form-control number required' type='text' name='busiMaterialRequireList[%s].amount' value='%s'>", index, value);
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue