This commit is contained in:
parent
00c2ec9bd8
commit
bfe641ed15
|
@ -41,7 +41,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/purchaseOrder")
|
@RequestMapping("/system/purchaseOrder")
|
||||||
public class PurchaseOrderMainController extends BaseController
|
public class PurchaseOrderController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "system/purchaseOrder";
|
private String prefix = "system/purchaseOrder";
|
||||||
|
|
||||||
|
@ -131,7 +131,6 @@ public class PurchaseOrderMainController extends BaseController
|
||||||
excelReader.finish();
|
excelReader.finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<PurchaseOrderImport> list = purchaseOrderListener.list;
|
List<PurchaseOrderImport> list = purchaseOrderListener.list;
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
@ -155,6 +154,8 @@ public class PurchaseOrderMainController extends BaseController
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(PurchaseOrderMain purchaseOrderMain)
|
public AjaxResult editSave(PurchaseOrderMain purchaseOrderMain)
|
||||||
{
|
{
|
||||||
|
SysUser sysUser = ShiroUtils.getSysUser();
|
||||||
|
purchaseOrderMain.setUpdateBy(String.valueOf(sysUser.getUserId()));
|
||||||
return toAjax(purchaseOrderMainService.updatePurchaseOrderMain(purchaseOrderMain));
|
return toAjax(purchaseOrderMainService.updatePurchaseOrderMain(purchaseOrderMain));
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,61 +8,67 @@
|
||||||
<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-purchaseOrder-add">
|
<form class="form-horizontal m" id="form-purchaseOrder-add">
|
||||||
<h4 class="form-header h4">采购单主表信息</h4>
|
<h4 class="form-header h4">采购单主表信息</h4>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">订单号:</label>
|
<label class="col-sm-2 control-label">采购单号:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-4">
|
||||||
<input name="orderNo" class="form-control" type="text" th:value="${orderNo}" readonly>
|
<input name="orderNo" class="form-control" type="text" th:value="${orderNo}" readonly>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">采购标题:</label>
|
<label class="col-sm-2 control-label">采购标题:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-10">
|
||||||
<input name="title" class="form-control" type="text">
|
<input name="title" class="form-control" type="text" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- <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 name="totalQuantity" class="form-control" type="text">
|
<input name="totalQuantity" class="form-control" type="text">
|
||||||
</div>
|
</div>
|
||||||
</div>-->
|
</div>-->
|
||||||
<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 name="totalPrice" class="form-control" type="text">
|
<input name="totalPrice" class="form-control" type="text">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>-->
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">供应商名称:</label>
|
<label class="col-sm-2 control-label">供应商:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-4">
|
||||||
<input name="supplierName" class="form-control" type="text">
|
<input name="supplierName" class="form-control" type="text">
|
||||||
</div>
|
</div>
|
||||||
|
<label class="col-sm-2 control-label">采购人:</label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<input name="belongUser" class="form-control" type="text">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">订货日期:</label>
|
<label class="col-sm-2 control-label">订货日期:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-4">
|
||||||
<div class="input-group date">
|
<div class="input-group date">
|
||||||
<input name="orderTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
<input name="orderTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
||||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<label class="col-sm-2 control-label">交货日期:</label>
|
||||||
<div class="form-group">
|
<div class="col-sm-4">
|
||||||
<label class="col-sm-3 control-label">交货日期:</label>
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<div class="input-group date">
|
<div class="input-group date">
|
||||||
<input name="deliveryDate" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
<input name="deliveryDate" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
||||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">采购人:</label>
|
<label class="col-sm-2 control-label">备注:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-10">
|
||||||
<input name="belongUser" class="form-control" type="text">
|
<textarea name="remark" class="form-control"></textarea>
|
||||||
</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">
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<input name="orderNo" th:field="*{orderNo}" class="form-control" type="text">
|
<input name="orderNo" th:field="*{orderNo}" class="form-control" type="text">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<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 name="totalQuantity" th:field="*{totalQuantity}" class="form-control" type="text">
|
<input name="totalQuantity" th:field="*{totalQuantity}" class="form-control" type="text">
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input name="totalPrice" th:field="*{totalPrice}" class="form-control" type="text">
|
<input name="totalPrice" th:field="*{totalPrice}" class="form-control" type="text">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>-->
|
||||||
<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">
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<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 name="supplierName" th:field="*{supplierName}" class="form-control" type="text">
|
<input name="supplierName" th:field="*{supplierName}" class="form-control" type="text">
|
||||||
</div>
|
</div>
|
||||||
|
@ -57,26 +57,18 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-3 control-label">审批状态:</label>
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<div class="radio-box" th:each="dict : ${@dict.getType('process_status')}">
|
|
||||||
<input type="radio" th:id="${'processStatus_' + dict.dictCode}" name="processStatus" th:value="${dict.dictValue}" th:field="*{processStatus}">
|
|
||||||
<label th:for="${'processStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<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 name="belongUser" th:field="*{belongUser}" class="form-control" type="text">
|
<input name="belongUser" th:field="*{belongUser}" class="form-control" type="text">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h4 class="form-header h4">${subTable.functionName}信息</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-success btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i></button>
|
||||||
<button type="button" class="btn btn-white btn-sm" onclick="sub.delColumn()"><i class="fa fa-minus"> 删除</i></button>
|
<button type="button" class="btn btn-warning btn-sm" onclick="sub.delColumn()"><i class="fa fa-minus"> 删除</i></button>
|
||||||
<div class="col-sm-12 select-table table-striped">
|
<div class="col-sm-12 select-table table-striped">
|
||||||
<table id="bootstrap-table"></table>
|
<table id="bootstrap-table"></table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -118,6 +110,7 @@
|
||||||
showRefresh: false,
|
showRefresh: false,
|
||||||
showToggle: false,
|
showToggle: false,
|
||||||
showColumns: false,
|
showColumns: false,
|
||||||
|
sidePagination: "client",
|
||||||
columns: [{
|
columns: [{
|
||||||
checkbox: true
|
checkbox: true
|
||||||
},
|
},
|
||||||
|
@ -130,6 +123,15 @@
|
||||||
return columnIndex + $.table.serialNumber(index);
|
return columnIndex + $.table.serialNumber(index);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'goodsNo',
|
||||||
|
align: 'center',
|
||||||
|
title: '货物编号',
|
||||||
|
formatter: function(value, row, index) {
|
||||||
|
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].goodsNo' value='%s'>", index, value);
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'goodsName',
|
field: 'goodsName',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
@ -183,68 +185,21 @@
|
||||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].remark' value='%s'>", index, value);
|
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].remark' value='%s'>", index, value);
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
},
|
}]
|
||||||
{
|
|
||||||
field: 'goodsNo',
|
|
||||||
align: 'center',
|
|
||||||
title: '货物编号',
|
|
||||||
formatter: function(value, row, index) {
|
|
||||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].goodsNo' value='%s'>", index, value);
|
|
||||||
return html;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'isDelete',
|
|
||||||
align: 'center',
|
|
||||||
title: '货物编号',
|
|
||||||
formatter: function(value, row, index) {
|
|
||||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].isDelete' value='%s'>", index, value);
|
|
||||||
return html;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'createTime',
|
|
||||||
align: 'center',
|
|
||||||
title: '货物编号',
|
|
||||||
formatter: function(value, row, index) {
|
|
||||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].createTime' value='%s'>", index, value);
|
|
||||||
return html;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'createBy',
|
|
||||||
align: 'center',
|
|
||||||
title: '货物编号',
|
|
||||||
formatter: function(value, row, index) {
|
|
||||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].createBy' value='%s'>", index, value);
|
|
||||||
return html;
|
|
||||||
}
|
|
||||||
|
|
||||||
}]
|
|
||||||
};
|
};
|
||||||
$.table.init(options);
|
$.table.init(options);
|
||||||
});
|
});
|
||||||
|
|
||||||
function addColumn() {
|
function addColumn() {
|
||||||
var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
var row = {
|
||||||
sub.editColumn();
|
goodsNo: "",
|
||||||
|
goodsName: "",
|
||||||
$("#" + table.options.id).bootstrapTable('insertRow', {
|
goodsSize: "",
|
||||||
index: count,
|
goodsQuantity: "",
|
||||||
row: {
|
goodsPrice: "",
|
||||||
index: $.table.serialNumber(count),
|
totalPrice: "",
|
||||||
goodsName: "",
|
remark: ""
|
||||||
goodsSize: "",
|
};
|
||||||
goodsQuantity: "",
|
sub.addColumn(row);
|
||||||
goodsPrice: "",
|
|
||||||
totalPrice: "",
|
|
||||||
remark: "",
|
|
||||||
goodsNo: "",
|
|
||||||
isDelete: "",
|
|
||||||
createTime: "",
|
|
||||||
createBy: ""
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
<input type="text" name="title"/>
|
<input type="text" name="title"/>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label>供应商名称:</label>
|
<label>供应商:</label>
|
||||||
<input type="text" name="supplierName"/>
|
<input type="text" name="supplierName"/>
|
||||||
</li>
|
</li>
|
||||||
<li class="select-time">
|
<!-- <li class="select-time">
|
||||||
<label>订货日期:</label>
|
<label>订货日期:</label>
|
||||||
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginOrderTime]"/>
|
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginOrderTime]"/>
|
||||||
<span>-</span>
|
<span>-</span>
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginDeliveryDate]"/>
|
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginDeliveryDate]"/>
|
||||||
<span>-</span>
|
<span>-</span>
|
||||||
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endDeliveryDate]"/>
|
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endDeliveryDate]"/>
|
||||||
</li>
|
</li>-->
|
||||||
<li>
|
<li>
|
||||||
<label>审批状态:</label>
|
<label>审批状态:</label>
|
||||||
<select name="processStatus" th:with="type=${@dict.getType('process_status')}">
|
<select name="processStatus" th:with="type=${@dict.getType('process_status')}">
|
||||||
|
@ -92,10 +92,15 @@
|
||||||
title: 'id',
|
title: 'id',
|
||||||
visible: false
|
visible: false
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
field: 'orderNo',
|
field: 'orderNo',
|
||||||
title: '订单号'
|
title: '订单号'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'title',
|
||||||
|
title: '采购标题'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'totalQuantity',
|
field: 'totalQuantity',
|
||||||
title: '总数量'
|
title: '总数量'
|
||||||
|
@ -104,10 +109,7 @@
|
||||||
field: 'totalPrice',
|
field: 'totalPrice',
|
||||||
title: '采购总金额'
|
title: '采购总金额'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
field: 'title',
|
|
||||||
title: '采购标题'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
field: 'supplierName',
|
field: 'supplierName',
|
||||||
title: '供应商名称'
|
title: '供应商名称'
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package com.snow.system.service.impl;
|
package com.snow.system.service.impl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.snow.common.exception.BusinessException;
|
||||||
import com.snow.common.utils.DateUtils;
|
import com.snow.common.utils.DateUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -60,6 +62,15 @@ public class PurchaseOrderMainServiceImpl implements IPurchaseOrderMainService
|
||||||
public int insertPurchaseOrderMain(PurchaseOrderMain purchaseOrderMain)
|
public int insertPurchaseOrderMain(PurchaseOrderMain purchaseOrderMain)
|
||||||
{
|
{
|
||||||
purchaseOrderMain.setCreateTime(DateUtils.getNowDate());
|
purchaseOrderMain.setCreateTime(DateUtils.getNowDate());
|
||||||
|
List<PurchaseOrderItem> purchaseOrderItemList = purchaseOrderMain.getPurchaseOrderItemList();
|
||||||
|
if(purchaseOrderItemList==null||purchaseOrderItemList.size()==0){
|
||||||
|
throw new BusinessException("采购单明细不能为空");
|
||||||
|
}
|
||||||
|
//计算总价格
|
||||||
|
BigDecimal priceTotal = purchaseOrderItemList.stream().map(PurchaseOrderItem::getTotalPrice).reduce(BigDecimal::add).get();
|
||||||
|
BigDecimal goodsQuantityTotal = purchaseOrderItemList.stream().map(PurchaseOrderItem::getGoodsQuantity).reduce(BigDecimal::add).get();
|
||||||
|
purchaseOrderMain.setTotalPrice(priceTotal);
|
||||||
|
purchaseOrderMain.setTotalQuantity(goodsQuantityTotal);
|
||||||
int rows = purchaseOrderMainMapper.insertPurchaseOrderMain(purchaseOrderMain);
|
int rows = purchaseOrderMainMapper.insertPurchaseOrderMain(purchaseOrderMain);
|
||||||
insertPurchaseOrderItem(purchaseOrderMain);
|
insertPurchaseOrderItem(purchaseOrderMain);
|
||||||
return rows;
|
return rows;
|
||||||
|
@ -109,7 +120,7 @@ public class PurchaseOrderMainServiceImpl implements IPurchaseOrderMainService
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增${subTable.functionName}信息
|
* 新增信息
|
||||||
*
|
*
|
||||||
* @param purchaseOrderMain 采购单主表对象
|
* @param purchaseOrderMain 采购单主表对象
|
||||||
*/
|
*/
|
||||||
|
@ -122,7 +133,12 @@ public class PurchaseOrderMainServiceImpl implements IPurchaseOrderMainService
|
||||||
List<PurchaseOrderItem> list = new ArrayList<>();
|
List<PurchaseOrderItem> list = new ArrayList<>();
|
||||||
for (PurchaseOrderItem purchaseOrderItem : purchaseOrderItemList)
|
for (PurchaseOrderItem purchaseOrderItem : purchaseOrderItemList)
|
||||||
{
|
{
|
||||||
|
BigDecimal goodsPrice= Optional.ofNullable(purchaseOrderItem.getGoodsPrice()).orElse(new BigDecimal(0));
|
||||||
|
BigDecimal goodsQuantity=Optional.ofNullable(purchaseOrderItem.getGoodsQuantity()).orElse(new BigDecimal(0));
|
||||||
|
purchaseOrderItem.setTotalPrice(goodsPrice.multiply(goodsQuantity));
|
||||||
purchaseOrderItem.setPurchaseOrderNo(orderNo);
|
purchaseOrderItem.setPurchaseOrderNo(orderNo);
|
||||||
|
purchaseOrderItem.setCreateTime(DateUtils.getNowDate());
|
||||||
|
purchaseOrderItem.setCreateBy(purchaseOrderMain.getCreateBy());
|
||||||
list.add(purchaseOrderItem);
|
list.add(purchaseOrderItem);
|
||||||
}
|
}
|
||||||
if (list.size() > 0)
|
if (list.size() > 0)
|
||||||
|
|
Loading…
Reference in New Issue