修改根据材料和仓库获取库存
This commit is contained in:
@@ -538,10 +538,7 @@
|
||||
type: "get",
|
||||
url: '/depotItem/findStockNumByMaterialId',
|
||||
data: {
|
||||
materialId: mId,
|
||||
monthTime: monthTime,
|
||||
currentPage: 1,
|
||||
pageSize: 10
|
||||
materialId: mId
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
@@ -667,6 +664,7 @@
|
||||
pageSize: initPageSize,
|
||||
pageList: initPageNum,
|
||||
columns: [[
|
||||
|
||||
{
|
||||
title: '单据编号', field: 'Number', width: 150,
|
||||
formatter: function (value, row) {
|
||||
@@ -676,7 +674,10 @@
|
||||
},
|
||||
{title: '类型', field: 'Type', width: 100},
|
||||
{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 () {
|
||||
$.messager.alert('页面加载提示', '页面加载异常,请稍后再试!', 'error');
|
||||
|
||||
@@ -46,273 +46,213 @@
|
||||
<table id="tableForSelectData" style="top:300px;border-bottom-color:#FFFFFF"></table>
|
||||
</div>
|
||||
|
||||
<div id="materialDetailListDlg" class="easyui-dialog" style="width:900px;height:500px;padding:10px 20px" closed="true"
|
||||
modal="true" collapsible="false" closable="true">
|
||||
<table id="materialTableData" style="top:50px;border-bottom-color:#FFFFFF"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var setCategoryId = "1";
|
||||
var cid = 1;
|
||||
//初始化界面
|
||||
$(function () {
|
||||
//初始化系统基础信息
|
||||
initTableData();
|
||||
ininPager();
|
||||
});
|
||||
<script type="text/javascript">
|
||||
var setCategoryId = "1";
|
||||
var cid = 1;
|
||||
//初始化界面
|
||||
$(function () {
|
||||
//初始化系统基础信息
|
||||
initTableData();
|
||||
ininPager();
|
||||
});
|
||||
|
||||
|
||||
//初始化表格数据
|
||||
function initTableData() {
|
||||
//改变宽度和高度
|
||||
$("#searchForSelectPanel").panel({width: webW/2-70});
|
||||
$("#tableForSelectPanel").panel({width: webW/2-70});
|
||||
$('#tableForSelectData').datagrid({
|
||||
//title:'商品列表',
|
||||
//iconCls:'icon-save',
|
||||
//width:700,
|
||||
height: heightInfo,
|
||||
nowrap: false,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate: false,
|
||||
//选中单行
|
||||
singleSelect: true,
|
||||
collapsible: false,
|
||||
selectOnCheck: false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped: true,
|
||||
//loadFilter: pagerFilter,
|
||||
pageSize: initPageSize,
|
||||
pageList: initPageNum,
|
||||
columns: [[
|
||||
{field: 'id', width: 35, align: "center", hidden: true},
|
||||
{title: '品名', field: 'name', width: 150},
|
||||
{title: '型号', field: 'model', width: 100},
|
||||
{title: '类别', field: 'categoryName', width: 130},
|
||||
{title: '单位', field: 'unit', width: 60},
|
||||
{
|
||||
title: '库存', field: 'abc', width: 70, formatter: function (value, rec) {
|
||||
var monthTime = getNowFormatMonth();
|
||||
var mId = rec.id; //商品id
|
||||
var thisStock = 0;
|
||||
//查询库存
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: '/depotItem/findStockNumByMaterialId',
|
||||
data: {
|
||||
materialId: mId,
|
||||
monthTime: monthTime,
|
||||
currentPage: 1,
|
||||
pageSize: 10
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
if (res.data && res.data.page && res.data.page[0]) {
|
||||
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);
|
||||
});
|
||||
}
|
||||
//初始化表格数据
|
||||
function initTableData() {
|
||||
//改变宽度和高度
|
||||
$("#searchForSelectPanel").panel({width: webW/2-70});
|
||||
$("#tableForSelectPanel").panel({width: webW/2-70});
|
||||
$('#tableForSelectData').datagrid({
|
||||
//title:'商品列表',
|
||||
//iconCls:'icon-save',
|
||||
//width:700,
|
||||
height: heightInfo,
|
||||
nowrap: false,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate: false,
|
||||
//选中单行
|
||||
singleSelect: true,
|
||||
collapsible: false,
|
||||
selectOnCheck: false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped: true,
|
||||
//loadFilter: pagerFilter,
|
||||
pageSize: initPageSize,
|
||||
pageList: initPageNum,
|
||||
columns: [[
|
||||
{field: 'id', width: 35, align: "center", hidden: true},
|
||||
{title: '品名', field: 'name', width: 150},
|
||||
{title: '型号', field: 'model', width: 100},
|
||||
{title: '类别', field: 'categoryName', width: 130},
|
||||
{title: '单位', field: 'unit', width: 60},
|
||||
{
|
||||
title: '库存', field: 'abc', width: 70, formatter: function (value, rec) {
|
||||
var monthTime = getNowFormatMonth();
|
||||
var mId = rec.id; //商品id
|
||||
var thisStock = 0;
|
||||
//查询库存
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: '/depotItem/findStockNumByMaterialId',
|
||||
data: {
|
||||
materialId: mId
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
if (res.data && res.data.page && res.data.page[0]) {
|
||||
thisStock = res.data.page[0].thisSum - 0;
|
||||
if (thisStock > 0) {
|
||||
$("#tableForSelectPanel .class-" + rec.id).text(thisStock); //延迟加载库存数据
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
|
||||
}
|
||||
});
|
||||
return "<span class='class-" + rec.id + "'>" + thisStock + "</span>";
|
||||
}
|
||||
},
|
||||
]],
|
||||
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);
|
||||
|
||||
},
|
||||
error: function () {
|
||||
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
|
||||
}
|
||||
});
|
||||
return "<span class='class-" + rec.id + "'>" + thisStock + "</span>";
|
||||
}
|
||||
//关闭掉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);
|
||||
|
||||
}
|
||||
});
|
||||
showMaterialDetails(1, initPageSize);
|
||||
//关闭掉dialog
|
||||
$("#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 ininMaterialDetailPager(mId) {
|
||||
try {
|
||||
var opts = $("#materialTableData").datagrid('options');
|
||||
var pager = $("#materialTableData").datagrid('getPager');
|
||||
pager.pagination({
|
||||
onSelectPage: function (pageNum, pageSize) {
|
||||
opts.pageNumber = pageNum;
|
||||
opts.pageSize = pageSize;
|
||||
pager.pagination('refresh', {
|
||||
//分页信息处理
|
||||
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
|
||||
});
|
||||
getMaterialInOutList(mId, 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;
|
||||
showMaterialDetails(pageNum, pageSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化键盘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() {
|
||||
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');
|
||||
}
|
||||
catch (e) {
|
||||
$.messager.alert('异常处理提示', "分页信息异常 : " + e.name + ": " + e.message, 'error');
|
||||
}
|
||||
//搜索处理
|
||||
$("#searchForSelectBtn").unbind().bind({
|
||||
click: function () {
|
||||
showMaterialDetails(1, initPageSize);
|
||||
var opts = $("#tableForSelectData").datagrid('options');
|
||||
var pager = $("#tableForSelectData").datagrid('getPager');
|
||||
opts.pageNumber = 1;
|
||||
opts.pageSize = initPageSize;
|
||||
pager.pagination('refresh', {
|
||||
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;
|
||||
}
|
||||
}
|
||||
//搜索处理
|
||||
$("#searchForSelectBtn").unbind().bind({
|
||||
click: function () {
|
||||
showMaterialDetails(1, initPageSize);
|
||||
var opts = $("#tableForSelectData").datagrid('options');
|
||||
var pager = $("#tableForSelectData").datagrid('getPager');
|
||||
opts.pageNumber = 1;
|
||||
opts.pageSize = initPageSize;
|
||||
pager.pagination('refresh', {
|
||||
pageNumber: 1,
|
||||
pageSize: initPageSize
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//重置按钮
|
||||
$("#searchForSelectResetBtn").unbind().bind({
|
||||
click: function () {
|
||||
$("#searchForSelectName").val("");
|
||||
setCategoryId = "1";
|
||||
//加载完以后重新初始化
|
||||
$("#searchForSelectBtn").click();
|
||||
|
||||
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({
|
||||
click: function () {
|
||||
$("#searchForSelectName").val("");
|
||||
setCategoryId = "1";
|
||||
//加载完以后重新初始化
|
||||
$("#searchForSelectBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -4,7 +4,8 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
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.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.depotItem.DepotItemService;
|
||||
@@ -12,8 +13,10 @@ import com.jsh.erp.service.material.MaterialService;
|
||||
import com.jsh.erp.utils.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
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.servlet.http.HttpServletRequest;
|
||||
@@ -73,6 +76,8 @@ public class DepotItemController {
|
||||
item.put("Type", d.getNewtype()); //进出类型
|
||||
item.put("BasicNumber", d.getBnum()); //数量
|
||||
item.put("OperTime", d.getOtime()); //时间
|
||||
item.put("depotName", d.getDepotName()); //仓库名称
|
||||
item.put("depotInName", d.getDepotInName()); //调入仓库名称
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
@@ -113,55 +118,21 @@ public class DepotItemController {
|
||||
|
||||
/**
|
||||
* 只根据商品id查询库存数量
|
||||
* @param pageSize
|
||||
* @param currentPage
|
||||
* @param mId
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/findStockNumByMaterialId")
|
||||
@RequestMapping(value = "/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("monthTime") String monthTime,
|
||||
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>();
|
||||
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数组
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if (null != list) {
|
||||
for (DepotItemVo4Material di : list) {
|
||||
JSONObject item = new JSONObject();
|
||||
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);
|
||||
}
|
||||
}
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("thisSum", depotItemService.getCurrentRepByMaterialIdAndDepotId(Long.valueOf(mId),null));
|
||||
dataArray.add(item);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,10 @@ public class DepotItemVo4DetailByTypeAndMId {
|
||||
private Integer bnum;
|
||||
|
||||
private Date otime;
|
||||
//仓库名称
|
||||
private String depotName;
|
||||
//调入仓库名称
|
||||
private String depotInName;
|
||||
|
||||
public String getNumber() {
|
||||
return number;
|
||||
@@ -43,4 +47,20 @@ public class DepotItemVo4DetailByTypeAndMId {
|
||||
public void setOtime(Date 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="b_num" jdbcType="BIGINT" property="bnum" />
|
||||
<result column="oTime" jdbcType="TIMESTAMP" property="otime" />
|
||||
<result column="depotName" jdbcType="VARCHAR" property="depotName" />
|
||||
<result column="depotInName" jdbcType="VARCHAR" property="depotInName" />
|
||||
</resultMap>
|
||||
|
||||
<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 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,
|
||||
date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime
|
||||
case when dh.type='入库' then ifnull(di.BasicNumber,0)
|
||||
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
|
||||
INNER JOIN jsh_depotitem di on dh.id=di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
|
||||
where dh.type!='其它'
|
||||
and dh.SubType!='调拨'
|
||||
left join jsh_depot depot on depot.id=di.depotId and ifnull(depot.delete_Flag,'0') !='1'
|
||||
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 ifnull(dh.delete_Flag,'0') !='1'
|
||||
ORDER BY oTime desc
|
||||
@@ -108,8 +120,10 @@
|
||||
select count(1)
|
||||
from jsh_depothead dh
|
||||
INNER JOIN jsh_depotitem di on dh.id=di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
|
||||
where dh.type!='其它'
|
||||
and dh.SubType!='调拨'
|
||||
left join jsh_depot depot on depot.id=di.depotId and ifnull(depot.delete_Flag,'0') !='1'
|
||||
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 ifnull(dh.delete_Flag,'0') !='1'
|
||||
</select>
|
||||
@@ -589,24 +603,24 @@
|
||||
AND intype.BasicInNumber > 0
|
||||
</select>
|
||||
<select id="getCurrentRepByMaterialIdAndDepotId" resultType="java.math.BigDecimal">
|
||||
select ((curep.inTotal+curep.transfInTotal+curep.assemInTotal+curep.disAssemInTotal)
|
||||
-(curep.transfOutTotal+curep.outTotal+curep.assemOutTotal+curep.disAssemOutTotal)) as currentRepo
|
||||
from
|
||||
(select sum(if(dh.type='入库' and di.DepotId=#{depotId},di.BasicNumber,0)) as inTotal,
|
||||
sum(if(dh.SubType='调拨' and di.AnotherDepotId=#{depotId},di.BasicNumber,0)) as transfInTotal,
|
||||
sum(if(dh.SubType='调拨' and di.DepotId=#{depotId},di.BasicNumber,0)) as transfOutTotal,
|
||||
sum(if(dh.type='出库' and dh.SubType!='调拨' and di.DepotId=#{depotId},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='普通子件' and di.DepotId=#{depotId},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='组合件' and di.DepotId=#{depotId},di.BasicNumber,0)) as disAssemOutTotal
|
||||
from
|
||||
jsh_depothead dh,jsh_depotitem di
|
||||
where 1=1
|
||||
and dh.id=di.HeaderId
|
||||
and di.MaterialId=#{materialId}
|
||||
and ifnull(dh.delete_Flag,'0') !='1'
|
||||
and ifnull(di.delete_Flag,'0') !='1') curep
|
||||
select ((curep.inTotal+curep.transfInTotal+curep.assemInTotal+curep.disAssemInTotal)
|
||||
-(curep.transfOutTotal+curep.outTotal+curep.assemOutTotal+curep.disAssemOutTotal)) as currentRepo
|
||||
from
|
||||
(select sum(if(dh.type='入库' <if test="depotId != null">and di.DepotId=#{depotId}</if>, di.BasicNumber,0)) as inTotal,
|
||||
sum(if(dh.SubType='调拨' <if test="depotId != null">and di.AnotherDepotId=#{depotId}</if>,di.BasicNumber,0)) as transfInTotal,
|
||||
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!='调拨' <if test="depotId != null">and di.DepotId=#{depotId}</if>,di.BasicNumber,0)) as outTotal,
|
||||
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='普通子件' <if test="depotId != null">and di.DepotId=#{depotId}</if>,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 disAssemInTotal,
|
||||
sum(if(dh.SubType='拆卸单' and di.MType='组合件' <if test="depotId != null"> and di.DepotId=#{depotId}</if>,di.BasicNumber,0)) as disAssemOutTotal
|
||||
from
|
||||
jsh_depothead dh,jsh_depotitem di
|
||||
where 1=1
|
||||
and dh.id=di.HeaderId
|
||||
and di.MaterialId=#{materialId}
|
||||
and ifnull(dh.delete_Flag,'0') !='1'
|
||||
and ifnull(di.delete_Flag,'0') !='1') as curep
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user