Commit 8ad7d0d8 by zhanglt

Merge branch 'master' of http://gitlab.yqdchina.com/huyi/warehouse into zlt

parents afc02f47 6134ed62
...@@ -90,6 +90,9 @@ ...@@ -90,6 +90,9 @@
<if test="dbName == 'mssql'">'%'+#{code}+'%'</if> <if test="dbName == 'mssql'">'%'+#{code}+'%'</if>
<if test="dbName == 'mysql'">concat('%',#{code},'%')</if> <if test="dbName == 'mysql'">concat('%',#{code},'%')</if>
</if> </if>
<if test="qr != null and qr.id != null and qr.id != ''">
AND a.qr_id = #{qr.id}
</if>
</where> </where>
<choose> <choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''"> <when test="page !=null and page.orderBy != null and page.orderBy != ''">
......
...@@ -106,6 +106,13 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> { ...@@ -106,6 +106,13 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
return super.findPage(page, ledger); return super.findPage(page, ledger);
} }
public Page<LedgerInfo> findInfoPage(Page<LedgerInfo> page, LedgerInfo ledgerInfo) {
dataRuleFilter(ledgerInfo);
ledgerInfo.setPage(page);
page.setList(ledgerInfoMapper.findList(ledgerInfo));
return page;
}
@Transactional(readOnly = false) @Transactional(readOnly = false)
public void save(Ledger ledger) { public void save(Ledger ledger) {
Ledger oldLeger = mapper.findByTypeAndModel(ledger); Ledger oldLeger = mapper.findByTypeAndModel(ledger);
...@@ -174,4 +181,14 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> { ...@@ -174,4 +181,14 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
ledgerInfoMapper.delete(new LedgerInfo(ledger)); ledgerInfoMapper.delete(new LedgerInfo(ledger));
} }
@Transactional(readOnly = false)
public LedgerInfo findByQrOrCode(LedgerInfo ledgerInfo) {
List<LedgerInfo> ledgerInfoList = ledgerInfoMapper.findList(ledgerInfo);
if (null != ledgerInfoList && ledgerInfoList.size() > 0) {
return ledgerInfoList.get(0);
} else {
return null;
}
}
} }
\ No newline at end of file
...@@ -12,6 +12,8 @@ import javax.servlet.http.HttpServletRequest; ...@@ -12,6 +12,8 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolationException; import javax.validation.ConstraintViolationException;
import com.jeeplus.modules.warehouse.ledger.entity.LedgerInfo;
import com.jeeplus.modules.warehouse.qrcode.entity.QrCode;
import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -174,6 +176,8 @@ public class LedgerController extends BaseController { ...@@ -174,6 +176,8 @@ public class LedgerController extends BaseController {
return ledgerService.get(id); return ledgerService.get(id);
} }
@ResponseBody
@RequestMapping(value = "countLedger")
public Ledger countLedger(String id) { public Ledger countLedger(String id) {
return ledgerService.countLedger(id); return ledgerService.countLedger(id);
} }
...@@ -235,4 +239,45 @@ public class LedgerController extends BaseController { ...@@ -235,4 +239,45 @@ public class LedgerController extends BaseController {
} }
@ResponseBody
@RequestMapping(value = "infoDate")
public Map<String, Object> infoDate(LedgerInfo ledgerInfo, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<LedgerInfo> page = ledgerService.findInfoPage(new Page<LedgerInfo>(request, response), ledgerInfo);
return getBootstrapData(page);
}
/**
* 根据二维码id或者物资编码返货台账明细信息
* @param qrId
* @param code
* @return
*/
@ResponseBody
@RequestMapping(value = "findByQrOrCode")
public AjaxJson findByQrOrCode(String qrId, String code) {
AjaxJson j = new AjaxJson();
boolean b = false;
if (StringUtils.isNotBlank(qrId)) {
b = true;
}
if (StringUtils.isNotBlank(code)) {
b = true;
}
if (b) {
LedgerInfo temLi = new LedgerInfo();
QrCode qrCode = new QrCode();
qrCode.setId(qrId);
temLi.setQr(qrCode);
temLi.setCode(code);
LedgerInfo ledgerInfo = ledgerService.findByQrOrCode(temLi);
j.put("ledgerInfo", ledgerInfo);
j.setSuccess(true);
j.setMsg("查询成功");
} else {
j.setSuccess(false);
j.setMsg("查询失败");
}
return j;
}
} }
\ No newline at end of file
...@@ -22,7 +22,8 @@ public class CountStorageInfo extends DataEntity<StorageInfo> { ...@@ -22,7 +22,8 @@ public class CountStorageInfo extends DataEntity<StorageInfo> {
private GoodsInfo goodsInfo; // 货品明细id private GoodsInfo goodsInfo; // 货品明细id
private Shelves shelves; // 货架id private Shelves shelves; // 货架id
private Warehouse warehouse; // 仓库外键 private Warehouse warehouse; // 仓库外键
private BigDecimal sum; // 单价 private BigDecimal sum; // 总价
private BigDecimal amount; // 单价
private int num; // 数量 private int num; // 数量
private String state; // 入库状态 private String state; // 入库状态
...@@ -132,4 +133,12 @@ public class CountStorageInfo extends DataEntity<StorageInfo> { ...@@ -132,4 +133,12 @@ public class CountStorageInfo extends DataEntity<StorageInfo> {
public void setState(String state) { public void setState(String state) {
this.state = state; this.state = state;
} }
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
} }
...@@ -202,6 +202,7 @@ ...@@ -202,6 +202,7 @@
type.name AS "type.name", type.name AS "type.name",
a.model AS "model", a.model AS "model",
sum(a.amount) AS "sum", sum(a.amount) AS "sum",
a.amount AS "amount",
a.goods_info_id AS "goodsInfo.id", a.goods_info_id AS "goodsInfo.id",
a.shelves_id AS "shelves.id", a.shelves_id AS "shelves.id",
s.name AS "shelves.name", s.name AS "shelves.name",
...@@ -221,7 +222,7 @@ ...@@ -221,7 +222,7 @@
AND a.storage_id = #{storage.id} AND a.storage_id = #{storage.id}
</if> </if>
</where> </where>
GROUP BY a.goods_info_id,a.shelves_id,qr.state GROUP BY a.goods_info_id,a.shelves_id,qr.state,a.amount
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -90,6 +90,7 @@ public class StorageService extends CrudService<StorageMapper, Storage> { ...@@ -90,6 +90,7 @@ public class StorageService extends CrudService<StorageMapper, Storage> {
csi.setName(c.getName()); csi.setName(c.getName());
csi.setType(c.getType()); csi.setType(c.getType());
csi.setState(c.getState()); csi.setState(c.getState());
csi.setAmount(c.getAmount());
} }
if (i != list.size() - 1) { if (i != list.size() - 1) {
shelvesNames = shelvesNames + c.getShelves().getName() + ","; shelvesNames = shelvesNames + c.getShelves().getName() + ",";
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
var data = ${fns:toJson(ledger.ledgerInfoList)}; var data = ${fns:toJson(ledger.ledgerInfoList)};
$(selector).bootstrapTable({ $(selector).bootstrapTable({
data: data, data: data,
columns:[{checkbox: true}, columns:[
{ {
field: 'no', field: 'no',
title: '序号', title: '序号',
...@@ -183,6 +183,10 @@ ...@@ -183,6 +183,10 @@
<input id="ledgerInfoList{{idx}}_batchNum" name="ledgerInfoList[{{idx}}].batchNum" type="text" value="{{row.batchNum}}" readonly onchange="onInputChange('{{idx}}', this, 'model')" class="form-control "/> <input id="ledgerInfoList{{idx}}_batchNum" name="ledgerInfoList[{{idx}}].batchNum" type="text" value="{{row.batchNum}}" readonly onchange="onInputChange('{{idx}}', this, 'model')" class="form-control "/>
</script> </script>
<script id="shelvesTpl" type="text/html">
<input id="ledgerInfoList{{idx}}_shelvesName" name="ledgerInfoList[{{idx}}].shelves.name" type="text" value="{{row.shelves.name}}" readonly onchange="onInputChange('{{idx}}', this, 'model')" class="form-control "/>
</script>
<script id="codeTpl" type="text/html"> <script id="codeTpl" type="text/html">
<input id="ledgerInfoList{{idx}}_code" name="ledgerInfoList[{{idx}}].code" type="text" value="{{row.code}}" readonly class="form-control" /> <input id="ledgerInfoList{{idx}}_code" name="ledgerInfoList[{{idx}}].code" type="text" value="{{row.code}}" readonly class="form-control" />
</script> </script>
...@@ -124,10 +124,10 @@ $(document).ready(function() { ...@@ -124,10 +124,10 @@ $(document).ready(function() {
} }
,{ ,{
field: 'shelvesIds', field: 'sum',
title: '货架id集合', title: '总价',
sortable: true, sortable: true,
sortName: 'shelvesIds' sortName: 'sum'
} }
,{ ,{
...@@ -138,10 +138,10 @@ $(document).ready(function() { ...@@ -138,10 +138,10 @@ $(document).ready(function() {
} }
,{ ,{
field: 'remarks', field: 'createDate',
title: '备注信息', title: '创建时间',
sortable: true, sortable: true,
sortName: 'remarks' sortName: 'createDate'
} }
] ]
...@@ -275,9 +275,9 @@ $(document).ready(function() { ...@@ -275,9 +275,9 @@ $(document).ready(function() {
var html = Mustache.render(htmltpl, { var html = Mustache.render(htmltpl, {
idx:row.id idx:row.id
}); });
$.get("${ctx}/warehouse/ledger/ledger/detail?id="+row.id, function(ledger){ $.get("${ctx}/warehouse/ledger/ledger/countLedger?id="+row.id, function(ledger){
var ledgerChild1RowIdx = 0, ledgerChild1Tpl = $("#ledgerChild1Tpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,""); var ledgerChild1RowIdx = 0, ledgerChild1Tpl = $("#ledgerChild1Tpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
var data1 = ledger.ledgerInfoList; var data1 = ledger.countLedgerInfoList;
for (var i=0; i<data1.length; i++){ for (var i=0; i<data1.length; i++){
data1[i].dict = {}; data1[i].dict = {};
addRow('#ledgerChild-'+row.id+'-1-List', ledgerChild1RowIdx, ledgerChild1Tpl, data1[i]); addRow('#ledgerChild-'+row.id+'-1-List', ledgerChild1RowIdx, ledgerChild1Tpl, data1[i]);
...@@ -312,7 +312,7 @@ $(document).ready(function() { ...@@ -312,7 +312,7 @@ $(document).ready(function() {
<th>型号</th> <th>型号</th>
<th>批次号</th> <th>批次号</th>
<th>货架</th> <th>货架</th>
<th>物资编码</th> <th>仓库</th>
</tr> </tr>
</thead> </thead>
<tbody id="ledgerChild-{{idx}}-1-List"> <tbody id="ledgerChild-{{idx}}-1-List">
...@@ -327,7 +327,7 @@ $(document).ready(function() { ...@@ -327,7 +327,7 @@ $(document).ready(function() {
{{row.name}} {{row.name}}
</td> </td>
<td> <td>
{{row.type.code}} {{row.type.name}}
</td> </td>
<td> <td>
{{row.model}} {{row.model}}
...@@ -336,22 +336,12 @@ $(document).ready(function() { ...@@ -336,22 +336,12 @@ $(document).ready(function() {
{{row.batchNum}} {{row.batchNum}}
</td> </td>
<td> <td>
{{row.ledger.id}} {{row.shelvesNames}}
</td>
<td>
{{row.goodsInfo.id}}
</td>
<td>
{{row.qr.id}}
</td>
<td>
{{row.shelves.name}}
</td>
<td>
{{row.code}}
</td> </td>
<td> <td>
{{row.remarks}} {{row.warehouseNames}}
</td> </td>
</tr>//--> </tr>//-->
</script> </script>
<%--
Created by IntelliJ IDEA.
User: yangzi
Date: 2023/2/21
Time: 10:29
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/webpage/include/taglib.jsp" %>
<div id="toolbar" class="text-left">
<c:if test="${mode == 'add' || mode == 'edit'}">
<a class="btn btn-primary btn-sm" onclick="addDetail('#detail_table')" title="新增"><i class="fa fa-plus"></i> 手动添加</a>
<a class="btn btn-primary btn-sm" onclick="addScan('#detail_table')" title="新增"><i class="fa fa-plus"></i> 扫码添加</a>
<a id="editAll" class="btn btn-primary btn-sm" onclick="addShelve('#detail_table')" title="新增"><i class="fa fa-plus"></i> 批量编辑货架</a>
</c:if>
</div>
<table id="detail_table" data-toolbar="#toolbar"></table>
<script>
var selector = "#detail_table";
function initTable(){
var data = ${fns:toJson(materialRequisition.materialRequisitionInfoList)};
$(selector).bootstrapTable({
data: data,
columns:[{checkbox: true},
{
field: 'no',
title: '序号',
align: 'center',
width: 60,
formatter: function (value, row, index){
var tpl = $("#hideTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, "");
var html = Mustache.render(tpl, {
idx: index,
row: row
})
return html + '<span>'+(index+1)+'</span>'
}
},
{
field: 'name',
title: '名称',
formatter: function (value,row,index){
return Mustache.render($("#nameTpl").html(),{
row: row,
idx: index
})
}
},
{
field: 'type.name',
title: '类型',
formatter: function (value,row,index){
return Mustache.render($("#typeTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""),{
row: row,
idx: index
})
}
},
{
field: 'remarks',
title: '备注',
formatter: function (value,row,index){
return Mustache.render($("#remarksTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""),{
row: row,
idx: index
})
}
},
{
field: '',
title: '操作',
formatter: function (value,row,index){
var text = row.delFlag == 1 ? '撤销删除' : '删除';
var result = ["<a href='javascript:void(0);' onclick=\"removeRow(" + index + ", '" + row.id + "', '" + row.delFlag + "')\">"+text+"</a>" ]
return result.join('');
}
}
]
});
$(selector).on('check.bs.table uncheck.bs.table load-success.bs.table ' +
'check-all.bs.table uncheck-all.bs.table', function () {
$('#editAll').prop('disabled', !getSelections().length);
});
}
function getSelections(){
return $(selector).bootstrapTable('getSelections');
}
/**
* 手动添加明细
* @param selector
*/
function addDetail(selector){
// 选择该批次号下的货品明细
if(!$("#batchNum").val()){
jp.warning('请选择批次号!');
return;
}
jp.openStorageSelectDialog({batchNum:$("#batchNum").val(),state: 0, isMultiSelect: true },function (items){
if(Array.isArray(items)){
var data = items.map(function (item){
if(item.goodsInfo && !item.goodsInfo.amount){
item.goodsInfo.amount = 0;
}
return {
id: '',
delFlag: 0,
remarks: '',
...item
}
})
$(selector).bootstrapTable('append', data)
}
})
}
function removeRow(index, rowId, rowDelFlag){
if(rowId){
var delFlag = rowDelFlag === 1 ? 0 : 1
updateRow(index, {
delFlag: delFlag
})
}else{
$(selector).bootstrapTable("remove", {
field: '$index',
values: [index]
})
}
}
function updateRow(index, row){
$(selector).bootstrapTable('updateRow', {
index: index,
row: row
})
}
function onInputChange(rowIndex, elem , field){
var obj = {};
obj[field] = $(elem).val()
var timer = null;
clearTimeout(timer);
timer = setTimeout(function (){
updateRow(rowIndex, obj)
}, 0)
}
function onSelectType(nodes, rowIndex){
if(Array.isArray(nodes) && nodes.length === 1){
var node = nodes[0];
var obj = {
type: {
id: node.id,
name: node.text
}
};
updateRow(rowIndex, obj)
}
}
/**
* 获取所有明细数据
* @returns {*|jQuery}
*/
function getTableData(){
return $(selector).bootstrapTable('getData');
}
function addShelve(){
jp.openShelvesSelectDialog(function (items){
var Shelve = items[0];
// TODO: 获取选中的明细下标
getSelections().forEach(function (item){
var index = getTableData().findIndex(function (current){
return current.qrCode.id === item.qrCode.id;
})
updateRow(index,{
shelves: {
id: Shelve.id,
name: Shelve.name
},
warehouse: Shelve.warehouse
})
})
})
}
/**
* 点击扫码显示扫码窗口
*/
function addScan(){
layer.open({
type: 1,
title: '扫码',
auto: true,
area: ['500','300'],
content: $("#scanResultTpl").html(),
success: function (){
$("#scanResult").focus();
},
btn:['关闭']
})
}
/**
* 扫码
* 一、获取扫码结果
* 二、请求后台接口获取结果
* 三、增一条明细数据
* 四、清空扫码结果
* @param elem
*/
function onScanChange(elem){
try{
var json = JSON.parse($(elem).val());
var qrCodeId = json.code;
var goodsInfoId = json.infoId;
jp.get('${ctx}/warehouse/goods/goods/getGIAndQCByTwoId?goodsInfoId='+goodsInfoId+"&qrCodeId="+qrCodeId, function (res){
var qrCode = res.body.qrCode;
$(selector).bootstrapTable('append',[
{
qrCode: qrCode,
goodsInfo: qrCode.goodsInfo,
...qrCode.goodsInfo,
id: '',
delFlag: 0,
remarks: ''
}
]);
$(elem).val('').focus();
})
}catch (e){
console.log(e);
}
}
</script>
<script id="hideTpl" type="text/html">
<input id="materialRequisitionInfoList{{idx}}_id" name="materialRequisitionInfoList[{{idx}}].id" type="hidden" value="{{row.id}}"/>
<input id="materialRequisitionInfoList{{idx}}_delFlag" name="materialRequisitionInfoList[{{idx}}].delFlag" type="hidden" value="{{row.delFlag}}"/>
<input id="materialRequisitionInfoList{{idx}}_materialRequisition" name="materialRequisitionInfoList[{{idx}}].materialRequisition.id" type="hidden" value="{{row.materialRequisition.id}}"/>
</script>
<script id="ledgerInfoTpl" type="text/html">//<!--
<sys:gridselect url="${ctx}/warehouse/ledger/ledger/data" id="materialRequisitionInfoList{{idx}}_ledgerInfo" name="materialRequisitionInfoList[{{idx}}].ledgerInfo.id" value="{{row.ledgerInfo.id}}" labelName="materialRequisitionInfoList[{{idx}}].ledgerInfo.name" labelValue="{{row.ledgerInfo.name}}"
title="选择物资" cssClass="form-control required" fieldLabels="物资名称|物资编号" fieldKeys="name|code" searchLabels="仓库名称|仓库编号" searchKeys="name|code" ></sys:gridselect>//-->
</script>
<script id="typeTpl" type="text/html">//<!--
<sys:treeselect id="storageInfoList{{idx}}_type" name="storageInfoList[{{idx}}].type.id" value="{{row.type.id}}" labelName="storageInfoList{{idx}}.type.name" labelValue="{{row.type.name}}"
title="类型" url="/warehouse/materialtype/materialType/treeData" cssClass="form-control " disabled="disabled" allowClear="true" allowSearch="true" callback="onSelectType" />//-->
</script>
<script id="modelTpl" type="text/html">
<input id="storageInfoList{{idx}}_model" name="storageInfoList[{{idx}}].model" type="text" value="{{row.model}}" readonly onchange="onInputChange('{{idx}}', this, 'model')" class="form-control "/>
</script>
<script id="shelvesTpl" type="text/html">
<input id="storageInfoList{{idx}}_shelvesName" name="storageInfoList[{{idx}}].shelves.name" type="text" value="{{row.shelves.name}}" readonly class="form-control" />
</script>
<script id="remarksTpl" type="text/html">
<textarea id="storageInfoList{{idx}}_remarks" name="storageInfoList[{{idx}}].remarks" rows="2" onchange="onInputChange('{{idx}}', this, 'remarks')" class="form-control ">{{row.remarks}}</textarea>
</script>
<script id="scanResultTpl" type="text/html">
<br>
<div class="container-fluid">
<div class="row">
<div class="col-xs-2 text-right">
<label>扫码结果:</label>
</div>
<div class="col-xs-10">
<input type="text" id="scanResult" class="form-control" onchange="onScanChange(this)">
<span class="text-danger">请切换英文输入法</span>
</div>
</div>
</div>
<br>
</script>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" %> <%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%> <%@ include file="/webpage/include/taglib.jsp" %>
<html> <html>
<head> <head>
<title>物资领用管理</title> <title>物资领用管理</title>
<meta name="decorator" content="ani"/> <meta name="decorator" content="ani"/>
<script type="text/javascript"> <link rel="stylesheet" href="${ctxStatic}/common/css/form.css">
<link rel="stylesheet" href="${ctxStatic}/plugin/bootstrapTable/bootstrap-table.min.css">
$(document).ready(function() { <script type="text/javascript" src="${ctxStatic}/plugin/bootstrapTable/bootstrap-table.min.js"></script>
jp.ajaxForm("#inputForm",function(data){ <script type="text/javascript" src="${ctxStatic}/plugin/bootstrapTable/bootstrap-table-zh-CN.js"></script>
if(data.success){
jp.success(data.msg);
jp.go("${ctx}/warehouse/materialrequisition/materialRequisition");
}else{
jp.error(data.msg);
$("#inputForm").find("button:submit").button("reset");
}
});
$('#time').datetimepicker({
format: "YYYY-MM-DD HH:mm:ss"
});
});
function addRow(list, idx, tpl, row){
$(list).append(Mustache.render(tpl, {
idx: idx, delBtn: true, row: row
}));
$(list+idx).find("select").each(function(){
$(this).val($(this).attr("data-value"));
});
$(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
var ss = $(this).attr("data-value").split(',');
for (var i=0; i<ss.length; i++){
if($(this).val() == ss[i]){
$(this).attr("checked","checked");
}
}
});
$(list+idx).find(".form_datetime").each(function(){
$(this).datetimepicker({
format: "YYYY-MM-DD HH:mm:ss"
});
});
}
function delRow(obj, prefix){
var id = $(prefix+"_id");
var delFlag = $(prefix+"_delFlag");
if (id.val() == ""){
$(obj).parent().parent().remove();
}else if(delFlag.val() == "0"){
delFlag.val("1");
$(obj).html("&divide;").attr("title", "撤销删除");
$(obj).parent().parent().addClass("error");
}else if(delFlag.val() == "1"){
delFlag.val("0");
$(obj).html("&times;").attr("title", "删除");
$(obj).parent().parent().removeClass("error");
}
}
</script>
</head> </head>
<body> <body>
<div class="wrapper wrapper-content"> <div class="wrapper wrapper-content">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">
<a class="panelButton" href="${ctx}/warehouse/materialrequisition/materialRequisition"><i class="ti-angle-left"></i> 返回</a>
</h3>
</div>
<div class="panel-body"> <div class="panel-body">
<form:form id="inputForm" modelAttribute="materialRequisition" action="${ctx}/warehouse/materialrequisition/materialRequisition/save" method="post" class="form-horizontal"> <form:form id="inputForm" modelAttribute="materialRequisition"
action="${ctx}/warehouse/materialrequisition/materialRequisition/save" method="post"
class="form-horizontal">
<form:hidden path="id"/> <form:hidden path="id"/>
<div class="form-group"> <h3 class="物资领用表"></h3>
<label class="col-sm-2 control-label">领用单号:</label> <table class="table table-bordered main-table">
<div class="col-sm-10"> <tr>
<form:input path="number" htmlEscape="false" class="form-control "/> <td> <font color="red">*</font>领用单号</td>
</div> <td>
</div> <form:input path="number" htmlEscape="false" readonly="true" class="form-control required"/>
<div class="form-group"> </td>
<label class="col-sm-2 control-label">操作人:</label> <td><font color="red">*</font>操作人</td>
<div class="col-sm-10"> <td>
<div class="col-sm-10"> <sys:userselect id="operator" name="operator.id"
<sys:userselect id="operator" name="operator.id" value="${materialRequisition.operator.id}" labelName="operator.name" labelValue="${materialRequisition.operator.name}" value="${materialRequisition.operator.id}" labelName="operator.name"
cssClass="form-control "/> labelValue="${materialRequisition.operator.name}" disabled="disabled"
</div> cssClass="form-control required"/>
<%-- <form:input path="operator" htmlEscape="false" class="form-control "/>--%> </td>
</div> </tr>
</div> <tr>
<td><font color="red">*</font>领用机构</td>
<div class="form-group"> <td>
<label class="col-sm-2 control-label">领用机构:</label> <sys:treeselect id="office" name="office.id" value="${materialRequisition.office.id}"
<div class="col-sm-10"> labelName="" labelValue="${materialRequisition.office.name}"
<sys:treeselect id="office" name="office.id" value="${materialRequisition.office.id}" labelName="" labelValue="${materialRequisition.office.name}" title="部门" url="/sys/office/treeData?type=2" cssClass="form-control required"
title="部门" url="/sys/office/treeData?type=2" cssClass="form-control " allowClear="true" notAllowSelectParent="true"/> allowClear="true" notAllowSelectParent="true"/>
</div> </td>
</div> <td><font color="red">*</font>领用时间</td>
<div class="form-group"> <td>
<label class="col-sm-2 control-label">领用时间:</label>
<div class="col-sm-10">
<div class='input-group form_datetime' id='time'> <div class='input-group form_datetime' id='time'>
<input type='text' name="time" class="form-control " value="<fmt:formatDate value="${materialRequisition.time}" pattern="yyyy-MM-dd HH:mm:ss"/>"/> <input type='text' name="time" class="form-control "
value="<fmt:formatDate value="${materialRequisition.time}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
<span class="input-group-addon"> <span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span> <span class="glyphicon glyphicon-calendar"></span>
</span> </span>
</div> </div>
</div> </td>
</div> </tr>
<div class="form-group"> <tr>
<label class="col-sm-2 control-label">备注信息:</label> <td>备注</td>
<div class="col-sm-10"> <td>
<form:textarea path="remarks" htmlEscape="false" rows="4" class="form-control "/> <form:textarea path="remarks" htmlEscape="false" rows="4" class="form-control "/>
</div> </td>
</div> </tr>
</table>
<div class="tabs-container"> <div class="tabs-container">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">领用明细表:</a> <li class="active"><a data-toggle="tab" href="#tab-1"
aria-expanded="true">领用明细表:</a>
</li> </li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div id="tab-1" class="tab-pane fade in active"> <div id="tab-1" class="tab-pane fade in active">
<a class="btn btn-white btn-sm" onclick="addRow('#materialRequisitionInfoList', materialRequisitionInfoRowIdx, materialRequisitionInfoTpl);materialRequisitionInfoRowIdx = materialRequisitionInfoRowIdx + 1;" title="新增"><i class="fa fa-plus"></i> 新增</a> <a class="btn btn-white btn-sm"
onclick="addRow('#materialRequisitionInfoList', materialRequisitionInfoRowIdx, materialRequisitionInfoTpl);materialRequisitionInfoRowIdx = materialRequisitionInfoRowIdx + 1;"
title="新增"><i class="fa fa-plus"></i> 新增</a>
<table class="table table-striped table-bordered table-condensed"> <table class="table table-striped table-bordered table-condensed">
<thead> <thead>
<tr> <tr>
...@@ -166,10 +115,11 @@ ...@@ -166,10 +115,11 @@
</tr>//--> </tr>//-->
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
var materialRequisitionInfoRowIdx = 0, materialRequisitionInfoTpl = $("#materialRequisitionInfoTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,""); var materialRequisitionInfoRowIdx = 0,
$(document).ready(function() { materialRequisitionInfoTpl = $("#materialRequisitionInfoTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, "");
$(document).ready(function () {
var data = ${fns:toJson(materialRequisition.materialRequisitionInfoList)}; var data = ${fns:toJson(materialRequisition.materialRequisitionInfoList)};
for (var i=0; i<data.length; i++){ for (var i = 0; i < data.length; i++) {
addRow('#materialRequisitionInfoList', materialRequisitionInfoRowIdx, materialRequisitionInfoTpl, data[i]); addRow('#materialRequisitionInfoList', materialRequisitionInfoRowIdx, materialRequisitionInfoTpl, data[i]);
materialRequisitionInfoRowIdx = materialRequisitionInfoRowIdx + 1; materialRequisitionInfoRowIdx = materialRequisitionInfoRowIdx + 1;
} }
...@@ -183,7 +133,9 @@ ...@@ -183,7 +133,9 @@
<div class="col-lg-6"> <div class="col-lg-6">
<div class="form-group text-center"> <div class="form-group text-center">
<div> <div>
<button class="btn btn-primary btn-block btn-lg btn-parsley" data-loading-text="正在提交...">提 交</button> <button class="btn btn-primary btn-block btn-lg btn-parsley"
data-loading-text="正在提交...">提 交
</button>
</div> </div>
</div> </div>
</div> </div>
...@@ -192,7 +144,25 @@ ...@@ -192,7 +144,25 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</div> </div>
</div> <script type="text/javascript">
$(document).ready(function() {
jp.ajaxForm("#inputForm",function(data){
if(data.success){
jp.success(data.msg);
jp.go("${ctx}/warehouse/materialrequisition/materialRequisition");
}else{
jp.error(data.msg);
$("#inputForm").find("button:submit").button("reset");
}
});
$('#time').datetimepicker({
format: "YYYY-MM-DD HH:mm:ss"
});
});
</script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -242,21 +242,21 @@ $(document).ready(function() { ...@@ -242,21 +242,21 @@ $(document).ready(function() {
$('#materialRequisitionTable').bootstrapTable('refresh'); $('#materialRequisitionTable').bootstrapTable('refresh');
} }
function add(){ function add(){
jp.go("${ctx}/warehouse/materialrequisition/materialRequisition/form/add"); jp.openSaveDialog("新增物资领用","${ctx}/warehouse/materialrequisition/materialRequisition/form/add",'1200','800');
} }
function edit(id){ function edit(id){
if(id == undefined){ if(id == undefined){
id = getIdSelections(); id = getIdSelections();
} }
jp.go("${ctx}/warehouse/materialrequisition/materialRequisition/form/edit?id=" + id); jp.openSaveDialog("编辑物资领用","${ctx}/warehouse/materialrequisition/materialRequisition/form/edit?id=" + id, '1200','800');
} }
function view(id){//没有权限时,不显示确定按钮 function view(id){//没有权限时,不显示确定按钮
if(id == undefined){ if(id == undefined){
id = getIdSelections(); id = getIdSelections();
} }
jp.go("${ctx}/warehouse/materialrequisition/materialRequisition/form/view?id=" + id); jp.openViewDialog("查看物资领用","${ctx}/warehouse/materialrequisition/materialRequisition/form/view?id=" + id,'1200','800');
} }
......
...@@ -284,6 +284,7 @@ $(document).ready(function() { ...@@ -284,6 +284,7 @@ $(document).ready(function() {
data1[i].jsonStr = JSON.stringify(data1[i]); data1[i].jsonStr = JSON.stringify(data1[i]);
data1[i].isNotStorage = data1[i].state === '1'; data1[i].isNotStorage = data1[i].state === '1';
data1[i].isStorage = data1[i].state === '2'; data1[i].isStorage = data1[i].state === '2';
data1[i].mainRowIndex = index;
addRow('#storageChild-'+row.id+'-1-List', storageChild1RowIdx, storageChild1Tpl, data1[i]); addRow('#storageChild-'+row.id+'-1-List', storageChild1RowIdx, storageChild1Tpl, data1[i]);
storageChild1RowIdx = storageChild1RowIdx + 1; storageChild1RowIdx = storageChild1RowIdx + 1;
} }
...@@ -300,7 +301,7 @@ $(document).ready(function() { ...@@ -300,7 +301,7 @@ $(document).ready(function() {
})); }));
} }
function onStorage(countStorage, goodsInfoId){ function onStorage(countStorage, goodsInfoId, rowIndex){
var main = JSON.parse(countStorage); var main = JSON.parse(countStorage);
jp.get("${ctx}/warehouse/storage/storage/findInfoBycountStorage?goodsInfo.id="+goodsInfoId+"&storage="+main.storageId, function (res){ jp.get("${ctx}/warehouse/storage/storage/findInfoBycountStorage?goodsInfo.id="+goodsInfoId+"&storage="+main.storageId, function (res){
var data = res.body.storageInfoList; var data = res.body.storageInfoList;
...@@ -330,12 +331,16 @@ $(document).ready(function() { ...@@ -330,12 +331,16 @@ $(document).ready(function() {
var qrId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].qr.id' value='"+item.qrCode.id+"' />"); var qrId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].qr.id' value='"+item.qrCode.id+"' />");
var shelvesId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].shelves.id' value='"+item.shelves.id+"' />"); var shelvesId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].shelves.id' value='"+item.shelves.id+"' />");
var code$ = $("<input type='hidden' name='ledgerInfoList["+index+"].code' value='"+item.qrCode.code+"' />"); var code$ = $("<input type='hidden' name='ledgerInfoList["+index+"].code' value='"+item.qrCode.code+"' />");
$("#ledgerForm").append(delFlag$).append(name$).append(typeId$).append(batchNum$).append(model$).append(goodsInfoId$).append(qrId$).append(shelvesId$).append(code$); $("#ledgerForm").append(id$).append(delFlag$).append(name$).append(typeId$).append(batchNum$).append(model$).append(goodsInfoId$).append(qrId$).append(shelvesId$).append(code$);
}) })
jp.loading('入库中...'); jp.loading('入库中...');
jp.post("${ctx}/warehouse/ledger/ledger/save", $("#ledgerForm").serialize(), function (res){ jp.post("${ctx}/warehouse/ledger/ledger/save", $("#ledgerForm").serialize(), function (res){
if(res.success){ if(res.success){
jp.success('入库成功!'); jp.success('入库成功!');
$('#storageTable').bootstrapTable('collapseRow', rowIndex);
setTimeout(function (){
$('#storageTable').bootstrapTable('expandRow', rowIndex);
},0)
}else { }else {
jp.error('入库失败!'); jp.error('入库失败!');
} }
...@@ -396,7 +401,7 @@ $(document).ready(function() { ...@@ -396,7 +401,7 @@ $(document).ready(function() {
</td> </td>
{{#row.isNotStorage}} {{#row.isNotStorage}}
<td> <td>
<a href="javascript:void(0);" onclick="onStorage('{{row.jsonStr}}','{{row.goodsInfo.id}}')">入库</a> <a href="javascript:void(0);" onclick="onStorage('{{row.jsonStr}}','{{row.goodsInfo.id}}',{{row.mainRowIndex}})">入库</a>
</td> </td>
{{/row.isNotStorage}} {{/row.isNotStorage}}
{{#row.isStorage}} {{#row.isStorage}}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment