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