修改根据材料和仓库获取库存
This commit is contained in:
@@ -538,10 +538,7 @@
|
|||||||
type: "get",
|
type: "get",
|
||||||
url: '/depotItem/findStockNumByMaterialId',
|
url: '/depotItem/findStockNumByMaterialId',
|
||||||
data: {
|
data: {
|
||||||
materialId: mId,
|
materialId: mId
|
||||||
monthTime: monthTime,
|
|
||||||
currentPage: 1,
|
|
||||||
pageSize: 10
|
|
||||||
},
|
},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
@@ -667,6 +664,7 @@
|
|||||||
pageSize: initPageSize,
|
pageSize: initPageSize,
|
||||||
pageList: initPageNum,
|
pageList: initPageNum,
|
||||||
columns: [[
|
columns: [[
|
||||||
|
|
||||||
{
|
{
|
||||||
title: '单据编号', field: 'Number', width: 150,
|
title: '单据编号', field: 'Number', width: 150,
|
||||||
formatter: function (value, row) {
|
formatter: function (value, row) {
|
||||||
@@ -676,7 +674,10 @@
|
|||||||
},
|
},
|
||||||
{title: '类型', field: 'Type', width: 100},
|
{title: '类型', field: 'Type', width: 100},
|
||||||
{title: '数量', field: 'BasicNumber', width: 80},
|
{title: '数量', field: 'BasicNumber', width: 80},
|
||||||
{title: '日期', field: 'OperTime', width: 180}
|
{title: '仓库', field: 'depotName', width: 180},
|
||||||
|
{title: '日期', field: 'OperTime', width: 180},
|
||||||
|
{title: '调入仓库', field: 'depotInName', width: 180}
|
||||||
|
|
||||||
]],
|
]],
|
||||||
onLoadError: function () {
|
onLoadError: function () {
|
||||||
$.messager.alert('页面加载提示', '页面加载异常,请稍后再试!', 'error');
|
$.messager.alert('页面加载提示', '页面加载异常,请稍后再试!', 'error');
|
||||||
|
|||||||
@@ -46,273 +46,213 @@
|
|||||||
<table id="tableForSelectData" style="top:300px;border-bottom-color:#FFFFFF"></table>
|
<table id="tableForSelectData" style="top:300px;border-bottom-color:#FFFFFF"></table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="materialDetailListDlg" class="easyui-dialog" style="width:900px;height:500px;padding:10px 20px" closed="true"
|
<script type="text/javascript">
|
||||||
modal="true" collapsible="false" closable="true">
|
var setCategoryId = "1";
|
||||||
<table id="materialTableData" style="top:50px;border-bottom-color:#FFFFFF"></table>
|
var cid = 1;
|
||||||
</div>
|
//初始化界面
|
||||||
|
$(function () {
|
||||||
<script type="text/javascript">
|
//初始化系统基础信息
|
||||||
var setCategoryId = "1";
|
initTableData();
|
||||||
var cid = 1;
|
ininPager();
|
||||||
//初始化界面
|
});
|
||||||
$(function () {
|
|
||||||
//初始化系统基础信息
|
|
||||||
initTableData();
|
|
||||||
ininPager();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
//初始化表格数据
|
//初始化表格数据
|
||||||
function initTableData() {
|
function initTableData() {
|
||||||
//改变宽度和高度
|
//改变宽度和高度
|
||||||
$("#searchForSelectPanel").panel({width: webW/2-70});
|
$("#searchForSelectPanel").panel({width: webW/2-70});
|
||||||
$("#tableForSelectPanel").panel({width: webW/2-70});
|
$("#tableForSelectPanel").panel({width: webW/2-70});
|
||||||
$('#tableForSelectData').datagrid({
|
$('#tableForSelectData').datagrid({
|
||||||
//title:'商品列表',
|
//title:'商品列表',
|
||||||
//iconCls:'icon-save',
|
//iconCls:'icon-save',
|
||||||
//width:700,
|
//width:700,
|
||||||
height: heightInfo,
|
height: heightInfo,
|
||||||
nowrap: false,
|
nowrap: false,
|
||||||
rownumbers: false,
|
rownumbers: false,
|
||||||
//动画效果
|
//动画效果
|
||||||
animate: false,
|
animate: false,
|
||||||
//选中单行
|
//选中单行
|
||||||
singleSelect: true,
|
singleSelect: true,
|
||||||
collapsible: false,
|
collapsible: false,
|
||||||
selectOnCheck: false,
|
selectOnCheck: false,
|
||||||
//fitColumns:true,
|
//fitColumns:true,
|
||||||
//单击行是否选中
|
//单击行是否选中
|
||||||
//checkOnSelect : false,
|
//checkOnSelect : false,
|
||||||
pagination: true,
|
pagination: true,
|
||||||
//交替出现背景
|
//交替出现背景
|
||||||
striped: true,
|
striped: true,
|
||||||
//loadFilter: pagerFilter,
|
//loadFilter: pagerFilter,
|
||||||
pageSize: initPageSize,
|
pageSize: initPageSize,
|
||||||
pageList: initPageNum,
|
pageList: initPageNum,
|
||||||
columns: [[
|
columns: [[
|
||||||
{field: 'id', width: 35, align: "center", hidden: true},
|
{field: 'id', width: 35, align: "center", hidden: true},
|
||||||
{title: '品名', field: 'name', width: 150},
|
{title: '品名', field: 'name', width: 150},
|
||||||
{title: '型号', field: 'model', width: 100},
|
{title: '型号', field: 'model', width: 100},
|
||||||
{title: '类别', field: 'categoryName', width: 130},
|
{title: '类别', field: 'categoryName', width: 130},
|
||||||
{title: '单位', field: 'unit', width: 60},
|
{title: '单位', field: 'unit', width: 60},
|
||||||
{
|
{
|
||||||
title: '库存', field: 'abc', width: 70, formatter: function (value, rec) {
|
title: '库存', field: 'abc', width: 70, formatter: function (value, rec) {
|
||||||
var monthTime = getNowFormatMonth();
|
var monthTime = getNowFormatMonth();
|
||||||
var mId = rec.id; //商品id
|
var mId = rec.id; //商品id
|
||||||
var thisStock = 0;
|
var thisStock = 0;
|
||||||
//查询库存
|
//查询库存
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "get",
|
type: "get",
|
||||||
url: '/depotItem/findStockNumByMaterialId',
|
url: '/depotItem/findStockNumByMaterialId',
|
||||||
data: {
|
data: {
|
||||||
materialId: mId,
|
materialId: mId
|
||||||
monthTime: monthTime,
|
},
|
||||||
currentPage: 1,
|
dataType: "json",
|
||||||
pageSize: 10
|
success: function (res) {
|
||||||
},
|
if(res && res.code === 200) {
|
||||||
dataType: "json",
|
if (res.data && res.data.page && res.data.page[0]) {
|
||||||
success: function (res) {
|
thisStock = res.data.page[0].thisSum - 0;
|
||||||
if(res && res.code === 200) {
|
if (thisStock > 0) {
|
||||||
if (res.data && res.data.page && res.data.page[0]) {
|
$("#tableForSelectPanel .class-" + rec.id).text(thisStock); //延迟加载库存数据
|
||||||
thisStock = res.data.page[0].thisSum - 0;
|
|
||||||
if (thisStock > 0) {
|
|
||||||
$("#tablePanel .class-" + rec.id).text(thisStock); //延迟加载库存数据
|
|
||||||
$("#tablePanel .class-" + rec.id).css("color", "blue").css("text-decoration", "underline").css("cursor", "pointer");
|
|
||||||
$("#tablePanel .class-" + rec.id).off("click").on("click", function () {
|
|
||||||
$('#materialDetailListDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 查看出入库明细');
|
|
||||||
$(".window-mask").css({width: webW, height: webH});
|
|
||||||
initMaterialDetailData(mId);
|
|
||||||
getMaterialInOutList(mId, 1, initPageSize);
|
|
||||||
ininMaterialDetailPager(mId);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
error: function () {
|
|
||||||
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
|
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
return "<span class='class-" + rec.id + "'>" + thisStock + "</span>";
|
error: function () {
|
||||||
}
|
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
|
||||||
},
|
}
|
||||||
]],
|
});
|
||||||
toolbar: [
|
return "<span class='class-" + rec.id + "'>" + thisStock + "</span>";
|
||||||
],
|
|
||||||
onLoadError: function () {
|
|
||||||
$.messager.alert('页面加载提示', '页面加载异常,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
},
|
|
||||||
onDblClickRow : function(rowIndex, rowData){
|
|
||||||
var selectType=$("#selectType").val();
|
|
||||||
console.log(rowData);
|
|
||||||
if(selectType=="lookForSelectMaterial"){
|
|
||||||
//单个添加序列号时选择
|
|
||||||
$("#materialId").val(rowData.id);
|
|
||||||
$("#materialName").val(rowData.name);
|
|
||||||
}else if(selectType=="batLookForSelectMaterial"){
|
|
||||||
//批量添加序列号时选择
|
|
||||||
$("#batAddMaterialName").val(rowData.name);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//关闭掉dialog
|
},
|
||||||
$("#forSelectMaterialDlg").dialog('close');
|
]],
|
||||||
|
toolbar: [
|
||||||
|
],
|
||||||
|
onLoadError: function () {
|
||||||
|
$.messager.alert('页面加载提示', '页面加载异常,请稍后再试!', 'error');
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
onDblClickRow : function(rowIndex, rowData){
|
||||||
|
var selectType=$("#selectType").val();
|
||||||
|
console.log(rowData);
|
||||||
|
if(selectType=="lookForSelectMaterial"){
|
||||||
|
//单个添加序列号时选择
|
||||||
|
$("#materialId").val(rowData.id);
|
||||||
|
$("#materialName").val(rowData.name);
|
||||||
|
}else if(selectType=="batLookForSelectMaterial"){
|
||||||
|
//批量添加序列号时选择
|
||||||
|
$("#batAddMaterialName").val(rowData.name);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
//关闭掉dialog
|
||||||
showMaterialDetails(1, initPageSize);
|
$("#forSelectMaterialDlg").dialog('close');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
showMaterialDetails(1, initPageSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//初始化键盘enter事件
|
||||||
|
$(document).keydown(function (event) {
|
||||||
|
//兼容 IE和firefox 事件
|
||||||
|
var e = window.event || event;
|
||||||
|
var k = e.keyCode || e.which || e.charCode;
|
||||||
|
//兼容 IE,firefox 兼容
|
||||||
|
var obj = e.srcElement ? e.srcElement : e.target;
|
||||||
|
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
|
||||||
|
if (k == "13" && (obj.id == "CategoryLevel" || obj.id == "Name")) {
|
||||||
|
$("#saveMaterial").click();
|
||||||
}
|
}
|
||||||
|
//搜索按钮添加快捷键
|
||||||
|
if (k == "13" && (obj.id == "searchCategoryId" || (obj.id == "searchName"))) {
|
||||||
|
$("#searchForSelectBtn").click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//分页信息处理
|
||||||
//分页信息处理
|
function ininPager() {
|
||||||
function ininMaterialDetailPager(mId) {
|
try {
|
||||||
try {
|
var opts = $("#tableForSelectData").datagrid('options');
|
||||||
var opts = $("#materialTableData").datagrid('options');
|
var pager = $("#tableForSelectData").datagrid('getPager');
|
||||||
var pager = $("#materialTableData").datagrid('getPager');
|
pager.pagination({
|
||||||
pager.pagination({
|
onSelectPage: function (pageNum, pageSize) {
|
||||||
onSelectPage: function (pageNum, pageSize) {
|
opts.pageNumber = pageNum;
|
||||||
opts.pageNumber = pageNum;
|
opts.pageSize = pageSize;
|
||||||
opts.pageSize = pageSize;
|
pager.pagination('refresh',
|
||||||
pager.pagination('refresh', {
|
{
|
||||||
pageNumber: pageNum,
|
pageNumber: pageNum,
|
||||||
pageSize: pageSize
|
pageSize: pageSize
|
||||||
});
|
});
|
||||||
getMaterialInOutList(mId, pageNum, pageSize);
|
showMaterialDetails(pageNum, pageSize);
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
$.messager.alert('异常处理提示', "分页信息异常 : " + e.name + ": " + e.message, 'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getMaterialInOutList(mId, pageNo, pageSize) {
|
|
||||||
$.ajax({
|
|
||||||
type: "get",
|
|
||||||
url: "/depotItem/findDetailByTypeAndMaterialId",
|
|
||||||
dataType: "json",
|
|
||||||
data: ({
|
|
||||||
materialId: mId,
|
|
||||||
currentPage: pageNo,
|
|
||||||
pageSize: pageSize
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200){
|
|
||||||
if(res.data && res.data.page) {
|
|
||||||
$("#materialTableData").datagrid('loadData', res.data.page);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error: function () {
|
|
||||||
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
catch (e) {
|
||||||
//初始化键盘enter事件
|
$.messager.alert('异常处理提示', "分页信息异常 : " + e.name + ": " + e.message, 'error');
|
||||||
$(document).keydown(function (event) {
|
|
||||||
//兼容 IE和firefox 事件
|
|
||||||
var e = window.event || event;
|
|
||||||
var k = e.keyCode || e.which || e.charCode;
|
|
||||||
//兼容 IE,firefox 兼容
|
|
||||||
var obj = e.srcElement ? e.srcElement : e.target;
|
|
||||||
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
|
|
||||||
if (k == "13" && (obj.id == "CategoryLevel" || obj.id == "Name")) {
|
|
||||||
$("#saveMaterial").click();
|
|
||||||
}
|
|
||||||
//搜索按钮添加快捷键
|
|
||||||
if (k == "13" && (obj.id == "searchCategoryId" || (obj.id == "searchName"))) {
|
|
||||||
$("#searchForSelectBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//分页信息处理
|
|
||||||
function ininPager() {
|
|
||||||
try {
|
|
||||||
var opts = $("#tableForSelectData").datagrid('options');
|
|
||||||
var pager = $("#tableForSelectData").datagrid('getPager');
|
|
||||||
pager.pagination({
|
|
||||||
onSelectPage: function (pageNum, pageSize) {
|
|
||||||
opts.pageNumber = pageNum;
|
|
||||||
opts.pageSize = pageSize;
|
|
||||||
pager.pagination('refresh',
|
|
||||||
{
|
|
||||||
pageNumber: pageNum,
|
|
||||||
pageSize: pageSize
|
|
||||||
});
|
|
||||||
showMaterialDetails(pageNum, pageSize);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
$.messager.alert('异常处理提示', "分页信息异常 : " + e.name + ": " + e.message, 'error');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//搜索处理
|
}
|
||||||
$("#searchForSelectBtn").unbind().bind({
|
//搜索处理
|
||||||
click: function () {
|
$("#searchForSelectBtn").unbind().bind({
|
||||||
showMaterialDetails(1, initPageSize);
|
click: function () {
|
||||||
var opts = $("#tableForSelectData").datagrid('options');
|
showMaterialDetails(1, initPageSize);
|
||||||
var pager = $("#tableForSelectData").datagrid('getPager');
|
var opts = $("#tableForSelectData").datagrid('options');
|
||||||
opts.pageNumber = 1;
|
var pager = $("#tableForSelectData").datagrid('getPager');
|
||||||
opts.pageSize = initPageSize;
|
opts.pageNumber = 1;
|
||||||
pager.pagination('refresh', {
|
opts.pageSize = initPageSize;
|
||||||
pageNumber: 1,
|
pager.pagination('refresh', {
|
||||||
pageSize: initPageSize
|
pageNumber: 1,
|
||||||
});
|
pageSize: initPageSize
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
function showMaterialDetails(pageNo, pageSize) {
|
|
||||||
var name = $.trim($("#searchForSelectName").val());
|
|
||||||
var model = $.trim($("#searchForSelectModel").val());
|
|
||||||
if (setCategoryId != "1") {
|
|
||||||
cid = 2;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cid = 1;
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
type: "get",
|
|
||||||
url: "/material/getMaterialEnableSerialNumberList",
|
|
||||||
dataType: "json",
|
|
||||||
data: ({
|
|
||||||
search: JSON.stringify({
|
|
||||||
name: name,
|
|
||||||
model: model
|
|
||||||
}),
|
|
||||||
currentPage: pageNo,
|
|
||||||
pageSize: pageSize
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200){
|
|
||||||
if(res.data && res.data.page) {
|
|
||||||
$("#tableForSelectData").datagrid('loadData', res.data.page);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error: function () {
|
|
||||||
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//重置按钮
|
|
||||||
$("#searchForSelectResetBtn").unbind().bind({
|
function showMaterialDetails(pageNo, pageSize) {
|
||||||
click: function () {
|
var name = $.trim($("#searchForSelectName").val());
|
||||||
$("#searchForSelectName").val("");
|
var model = $.trim($("#searchForSelectModel").val());
|
||||||
setCategoryId = "1";
|
if (setCategoryId != "1") {
|
||||||
//加载完以后重新初始化
|
cid = 2;
|
||||||
$("#searchForSelectBtn").click();
|
}
|
||||||
|
else {
|
||||||
|
cid = 1;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
type: "get",
|
||||||
|
url: "/material/getMaterialEnableSerialNumberList",
|
||||||
|
dataType: "json",
|
||||||
|
data: ({
|
||||||
|
search: JSON.stringify({
|
||||||
|
name: name,
|
||||||
|
model: model
|
||||||
|
}),
|
||||||
|
currentPage: pageNo,
|
||||||
|
pageSize: pageSize
|
||||||
|
}),
|
||||||
|
success: function (res) {
|
||||||
|
if(res && res.code === 200){
|
||||||
|
if(res.data && res.data.page) {
|
||||||
|
$("#tableForSelectData").datagrid('loadData', res.data.page);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//此处添加错误处理
|
||||||
|
error: function () {
|
||||||
|
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//重置按钮
|
||||||
|
$("#searchForSelectResetBtn").unbind().bind({
|
||||||
|
click: function () {
|
||||||
|
$("#searchForSelectName").val("");
|
||||||
|
setCategoryId = "1";
|
||||||
|
//加载完以后重新初始化
|
||||||
|
$("#searchForSelectBtn").click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ import com.alibaba.fastjson.JSONArray;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
import com.jsh.erp.constants.ExceptionConstants;
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
import com.jsh.erp.datasource.entities.*;
|
import com.jsh.erp.datasource.entities.DepotItemVo4DetailByTypeAndMId;
|
||||||
|
import com.jsh.erp.datasource.entities.DepotItemVo4WithInfoEx;
|
||||||
import com.jsh.erp.datasource.vo.DepotItemStockWarningCount;
|
import com.jsh.erp.datasource.vo.DepotItemStockWarningCount;
|
||||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.service.depotItem.DepotItemService;
|
import com.jsh.erp.service.depotItem.DepotItemService;
|
||||||
@@ -12,8 +13,10 @@ import com.jsh.erp.service.material.MaterialService;
|
|||||||
import com.jsh.erp.utils.*;
|
import com.jsh.erp.utils.*;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -73,6 +76,8 @@ public class DepotItemController {
|
|||||||
item.put("Type", d.getNewtype()); //进出类型
|
item.put("Type", d.getNewtype()); //进出类型
|
||||||
item.put("BasicNumber", d.getBnum()); //数量
|
item.put("BasicNumber", d.getBnum()); //数量
|
||||||
item.put("OperTime", d.getOtime()); //时间
|
item.put("OperTime", d.getOtime()); //时间
|
||||||
|
item.put("depotName", d.getDepotName()); //仓库名称
|
||||||
|
item.put("depotInName", d.getDepotInName()); //调入仓库名称
|
||||||
dataArray.add(item);
|
dataArray.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,55 +118,21 @@ public class DepotItemController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 只根据商品id查询库存数量
|
* 只根据商品id查询库存数量
|
||||||
* @param pageSize
|
|
||||||
* @param currentPage
|
|
||||||
* @param mId
|
* @param mId
|
||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/findStockNumByMaterialId")
|
@RequestMapping(value = "/findStockNumByMaterialId")
|
||||||
public String findStockNumByMaterialId(
|
public String findStockNumByMaterialId(
|
||||||
@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize,
|
|
||||||
@RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage,
|
|
||||||
@RequestParam("materialId") String mId,
|
@RequestParam("materialId") String mId,
|
||||||
@RequestParam("monthTime") String monthTime,
|
|
||||||
HttpServletRequest request) throws Exception{
|
HttpServletRequest request) throws Exception{
|
||||||
Map<String, String> parameterMap = ParamUtils.requestToMap(request);
|
|
||||||
parameterMap.put("mId", mId);
|
|
||||||
parameterMap.put("monthTime", monthTime);
|
|
||||||
PageQueryInfo queryInfo = new PageQueryInfo();
|
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
if (pageSize != null && pageSize <= 0) {
|
|
||||||
pageSize = 10;
|
|
||||||
}
|
|
||||||
String offset = ParamUtils.getPageOffset(currentPage, pageSize);
|
|
||||||
if (StringUtil.isNotEmpty(offset)) {
|
|
||||||
parameterMap.put(Constants.OFFSET, offset);
|
|
||||||
}
|
|
||||||
List<DepotItemVo4Material> list = depotItemService.findStockNumByMaterialIdList(parameterMap);
|
|
||||||
|
|
||||||
//存放数据json数组
|
//存放数据json数组
|
||||||
JSONArray dataArray = new JSONArray();
|
JSONArray dataArray = new JSONArray();
|
||||||
if (null != list) {
|
JSONObject item = new JSONObject();
|
||||||
for (DepotItemVo4Material di : list) {
|
item.put("thisSum", depotItemService.getCurrentRepByMaterialIdAndDepotId(Long.valueOf(mId),null));
|
||||||
JSONObject item = new JSONObject();
|
dataArray.add(item);
|
||||||
int InSum = sumNumberByMaterialId("入库", di.getMaterialid());
|
|
||||||
int OutSum = sumNumberByMaterialId("出库", di.getMaterialid());
|
|
||||||
item.put("MaterialId", di.getMaterialid() == null ? "" : di.getMaterialid());
|
|
||||||
item.put("MaterialName", di.getMname());
|
|
||||||
item.put("MaterialModel", di.getMmodel());
|
|
||||||
item.put("thisSum", InSum - OutSum);
|
|
||||||
dataArray.add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
objectMap.put("page", dataArray);
|
objectMap.put("page", dataArray);
|
||||||
if (list == null) {
|
|
||||||
queryInfo.setRows(new ArrayList<Object>());
|
|
||||||
queryInfo.setTotal(BusinessConstants.DEFAULT_LIST_NULL_NUMBER);
|
|
||||||
return returnJson(objectMap, "查找不到数据", ErpInfo.OK.code);
|
|
||||||
}
|
|
||||||
queryInfo.setRows(list);
|
|
||||||
queryInfo.setTotal(depotItemService.findStockNumByMaterialIdCounts(parameterMap));
|
|
||||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ public class DepotItemVo4DetailByTypeAndMId {
|
|||||||
private Integer bnum;
|
private Integer bnum;
|
||||||
|
|
||||||
private Date otime;
|
private Date otime;
|
||||||
|
//仓库名称
|
||||||
|
private String depotName;
|
||||||
|
//调入仓库名称
|
||||||
|
private String depotInName;
|
||||||
|
|
||||||
public String getNumber() {
|
public String getNumber() {
|
||||||
return number;
|
return number;
|
||||||
@@ -43,4 +47,20 @@ public class DepotItemVo4DetailByTypeAndMId {
|
|||||||
public void setOtime(Date otime) {
|
public void setOtime(Date otime) {
|
||||||
this.otime = otime;
|
this.otime = otime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDepotName() {
|
||||||
|
return depotName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepotName(String depotName) {
|
||||||
|
this.depotName = depotName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDepotInName() {
|
||||||
|
return depotInName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepotInName(String depotInName) {
|
||||||
|
this.depotInName = depotInName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,8 @@
|
|||||||
<result column="newType" jdbcType="VARCHAR" property="newtype" />
|
<result column="newType" jdbcType="VARCHAR" property="newtype" />
|
||||||
<result column="b_num" jdbcType="BIGINT" property="bnum" />
|
<result column="b_num" jdbcType="BIGINT" property="bnum" />
|
||||||
<result column="oTime" jdbcType="TIMESTAMP" property="otime" />
|
<result column="oTime" jdbcType="TIMESTAMP" property="otime" />
|
||||||
|
<result column="depotName" jdbcType="VARCHAR" property="depotName" />
|
||||||
|
<result column="depotInName" jdbcType="VARCHAR" property="depotInName" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap extends="com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap" id="ResultAndMaterialMap" type="com.jsh.erp.datasource.entities.DepotItemVo4Material">
|
<resultMap extends="com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap" id="ResultAndMaterialMap" type="com.jsh.erp.datasource.entities.DepotItemVo4Material">
|
||||||
@@ -91,12 +93,22 @@
|
|||||||
|
|
||||||
<select id="findDetailByTypeAndMaterialIdList" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="DetailByTypeAndMIdResultMap">
|
<select id="findDetailByTypeAndMaterialIdList" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="DetailByTypeAndMIdResultMap">
|
||||||
select dh.Number,concat(dh.SubType,dh.Type) as newType,
|
select dh.Number,concat(dh.SubType,dh.Type) as newType,
|
||||||
case when type='入库' then di.BasicNumber when type='出库' then 0-di.BasicNumber else 0 end as b_num,
|
case when dh.type='入库' then ifnull(di.BasicNumber,0)
|
||||||
date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime
|
when dh.type='出库' and dh.SubType!='调拨' then 0 - ifnull(di.BasicNumber,0)
|
||||||
|
when dh.SubType='组装单' and di.MType='组合件' then ifnull(di.BasicNumber,0)
|
||||||
|
when dh.SubType='组装单' and di.MType='普通子件' then 0-ifnull(di.BasicNumber,0)
|
||||||
|
when dh.SubType='拆卸单' and di.MType='普通子件' then ifnull(di.BasicNumber,0)
|
||||||
|
when dh.SubType='拆卸单' and di.MType='组合件' then 0-ifnull(di.BasicNumber,0)
|
||||||
|
when dh.SubType='调拨' then 0-ifnull(di.BasicNumber,0)
|
||||||
|
else 0 end as b_num,
|
||||||
|
date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime,
|
||||||
|
depot.name as depotName,depotIn.name as depotInName
|
||||||
from jsh_depothead dh
|
from jsh_depothead dh
|
||||||
INNER JOIN jsh_depotitem di on dh.id=di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
|
INNER JOIN jsh_depotitem di on dh.id=di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
|
||||||
where dh.type!='其它'
|
left join jsh_depot depot on depot.id=di.depotId and ifnull(depot.delete_Flag,'0') !='1'
|
||||||
and dh.SubType!='调拨'
|
left join jsh_depot depotIn on depotIn.id=di.AnotherDepotId and ifnull(depotIn.delete_Flag,'0') !='1'
|
||||||
|
where 1=1
|
||||||
|
and dh.SubType not in('采购订单','销售订单')
|
||||||
and di.MaterialId =#{mId}
|
and di.MaterialId =#{mId}
|
||||||
and ifnull(dh.delete_Flag,'0') !='1'
|
and ifnull(dh.delete_Flag,'0') !='1'
|
||||||
ORDER BY oTime desc
|
ORDER BY oTime desc
|
||||||
@@ -108,8 +120,10 @@
|
|||||||
select count(1)
|
select count(1)
|
||||||
from jsh_depothead dh
|
from jsh_depothead dh
|
||||||
INNER JOIN jsh_depotitem di on dh.id=di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
|
INNER JOIN jsh_depotitem di on dh.id=di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
|
||||||
where dh.type!='其它'
|
left join jsh_depot depot on depot.id=di.depotId and ifnull(depot.delete_Flag,'0') !='1'
|
||||||
and dh.SubType!='调拨'
|
left join jsh_depot depotIn on depotIn.id=di.AnotherDepotId and ifnull(depotIn.delete_Flag,'0') !='1'
|
||||||
|
where 1=1
|
||||||
|
and dh.SubType not in('采购订单','销售订单')
|
||||||
and di.MaterialId =#{mId}
|
and di.MaterialId =#{mId}
|
||||||
and ifnull(dh.delete_Flag,'0') !='1'
|
and ifnull(dh.delete_Flag,'0') !='1'
|
||||||
</select>
|
</select>
|
||||||
@@ -589,24 +603,24 @@
|
|||||||
AND intype.BasicInNumber > 0
|
AND intype.BasicInNumber > 0
|
||||||
</select>
|
</select>
|
||||||
<select id="getCurrentRepByMaterialIdAndDepotId" resultType="java.math.BigDecimal">
|
<select id="getCurrentRepByMaterialIdAndDepotId" resultType="java.math.BigDecimal">
|
||||||
select ((curep.inTotal+curep.transfInTotal+curep.assemInTotal+curep.disAssemInTotal)
|
select ((curep.inTotal+curep.transfInTotal+curep.assemInTotal+curep.disAssemInTotal)
|
||||||
-(curep.transfOutTotal+curep.outTotal+curep.assemOutTotal+curep.disAssemOutTotal)) as currentRepo
|
-(curep.transfOutTotal+curep.outTotal+curep.assemOutTotal+curep.disAssemOutTotal)) as currentRepo
|
||||||
from
|
from
|
||||||
(select sum(if(dh.type='入库' and di.DepotId=#{depotId},di.BasicNumber,0)) as inTotal,
|
(select sum(if(dh.type='入库' <if test="depotId != null">and di.DepotId=#{depotId}</if>, di.BasicNumber,0)) as inTotal,
|
||||||
sum(if(dh.SubType='调拨' and di.AnotherDepotId=#{depotId},di.BasicNumber,0)) as transfInTotal,
|
sum(if(dh.SubType='调拨' <if test="depotId != null">and di.AnotherDepotId=#{depotId}</if>,di.BasicNumber,0)) as transfInTotal,
|
||||||
sum(if(dh.SubType='调拨' and di.DepotId=#{depotId},di.BasicNumber,0)) as transfOutTotal,
|
sum(if(dh.SubType='调拨' <if test="depotId != null">and di.DepotId=#{depotId}</if>,di.BasicNumber,0)) as transfOutTotal,
|
||||||
sum(if(dh.type='出库' and dh.SubType!='调拨' and di.DepotId=#{depotId},di.BasicNumber,0)) as outTotal,
|
sum(if(dh.type='出库' and dh.SubType!='调拨' <if test="depotId != null">and di.DepotId=#{depotId}</if>,di.BasicNumber,0)) as outTotal,
|
||||||
sum(if(dh.SubType='组装单' and di.MType='组合件' and di.DepotId=#{depotId},di.BasicNumber,0)) as assemInTotal,
|
sum(if(dh.SubType='组装单' and di.MType='组合件' <if test="depotId != null">and di.DepotId=#{depotId}</if>,di.BasicNumber,0)) as assemInTotal,
|
||||||
sum(if(dh.SubType='组装单' and di.MType='普通子件' and di.DepotId=#{depotId},di.BasicNumber,0)) as assemOutTotal,
|
sum(if(dh.SubType='组装单' and di.MType='普通子件' <if test="depotId != null">and di.DepotId=#{depotId}</if>,di.BasicNumber,0)) as assemOutTotal,
|
||||||
sum(if(dh.SubType='拆卸单' and di.MType='普通子件' and di.DepotId=#{depotId},di.BasicNumber,0)) as disAssemInTotal,
|
sum(if(dh.SubType='拆卸单' and di.MType='普通子件' <if test="depotId != null">and di.DepotId=#{depotId}</if>,di.BasicNumber,0)) as disAssemInTotal,
|
||||||
sum(if(dh.SubType='拆卸单' and di.MType='组合件' and di.DepotId=#{depotId},di.BasicNumber,0)) as disAssemOutTotal
|
sum(if(dh.SubType='拆卸单' and di.MType='组合件' <if test="depotId != null"> and di.DepotId=#{depotId}</if>,di.BasicNumber,0)) as disAssemOutTotal
|
||||||
from
|
from
|
||||||
jsh_depothead dh,jsh_depotitem di
|
jsh_depothead dh,jsh_depotitem di
|
||||||
where 1=1
|
where 1=1
|
||||||
and dh.id=di.HeaderId
|
and dh.id=di.HeaderId
|
||||||
and di.MaterialId=#{materialId}
|
and di.MaterialId=#{materialId}
|
||||||
and ifnull(dh.delete_Flag,'0') !='1'
|
and ifnull(dh.delete_Flag,'0') !='1'
|
||||||
and ifnull(di.delete_Flag,'0') !='1') curep
|
and ifnull(di.delete_Flag,'0') !='1') as curep
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user