Commit 4d03ec75 by zhangtw

入库统计页面优化

parent cf620699
...@@ -49,12 +49,19 @@ export function delInbound_items(id) { ...@@ -49,12 +49,19 @@ export function delInbound_items(id) {
method: 'delete' method: 'delete'
}) })
} }
// 统计入库单明细 // 统计入库单明细
export function inbound_details(query){ export function inbound_details(query){
return request({ return request({
url: '/inventory/inbound_items/details', url: '/inventory/inbound_items/detailsList',
method: 'get', method: 'get',
params: query params: query
}) })
} }
// 明细关联信息
export function details_information(materialId){
return request({
url: 'inventory/inbound_items/detailsInformation',
method: 'get',
params: materialId
})
}
...@@ -23,19 +23,6 @@ ...@@ -23,19 +23,6 @@
@search="handleQuery" @search="handleQuery"
@reset="resetQuery" @reset="resetQuery"
> >
<el-form-item label="入库日期" prop="inboundDateRange">
<el-date-picker
v-model="inboundDateRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料SAPNO" prop="sapNo"> <el-form-item label="物料SAPNO" prop="sapNo">
<el-input <el-input
v-model="queryParams.sapNo" v-model="queryParams.sapNo"
...@@ -52,22 +39,7 @@ ...@@ -52,22 +39,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="关联入库单单号" prop="orderId">
<el-input
v-model="queryParams.orderId"
placeholder="请输入入库单单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="批次" prop="batchId">
<el-input
v-model="queryParams.batchId"
placeholder="请输入批次"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="仓库" prop="warehouseId"> <el-form-item label="仓库" prop="warehouseId">
<el-input <el-input
...@@ -93,7 +65,6 @@ ...@@ -93,7 +65,6 @@
readonly readonly
@focus="openLocationSelector" @focus="openLocationSelector"
:suffix-icon="''" :suffix-icon="''"
> >
<template v-if="queryLocationName" #suffix> <template v-if="queryLocationName" #suffix>
<i <i
...@@ -104,7 +75,7 @@ ...@@ -104,7 +75,7 @@
</template> </template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="标签颜色" prop="labelColor"> <!-- <el-form-item label="标签颜色" prop="labelColor">
<el-select v-model="queryParams.labelColor" placeholder="请选择标签颜色" clearable> <el-select v-model="queryParams.labelColor" placeholder="请选择标签颜色" clearable>
<el-option <el-option
v-for="dict in dict.type.label_color" v-for="dict in dict.type.label_color"
...@@ -113,7 +84,7 @@ ...@@ -113,7 +84,7 @@
:value="dict.value" :value="dict.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item> -->
</page-wrapper-search> </page-wrapper-search>
<!-- 表格区域 --> <!-- 表格区域 -->
...@@ -124,37 +95,167 @@ ...@@ -124,37 +95,167 @@
:data="inboundList" :data="inboundList"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
border border
:row-key="(row) => row.materialId + '_' + row.batchId +'_' + row.orderId + '_' + row.warehousesName + '_' + row.locationName" :row-key="(row) => row.materialId"
> >
<el-table-column label="物料SAPNO" align="center" prop="sapNo" min-width="200"/> <el-table-column type="index" label="序号" width="60" align="center" fixed="left" />
<el-table-column label="物料名称" align="center" prop="materialName" min-width="200"/> <el-table-column label="物料名称" align="center" prop="materialName" min-width="150" show-overflow-tooltip />
<el-table-column label="关联入库单" align="center" prop="orderId" :show-overflow-tooltip="true" min-width="200"/> <el-table-column label="SAP物料号" align="center" prop="sapNo" width="120" />
<el-table-column label="批次号" align="center" prop="batchId" :show-overflow-tooltip="true" min-width="200"/> <el-table-column label="TS Code" align="center" prop="tsCode" width="120" />
<el-table-column label="源仓库" align="center" prop="warehousesName" min-width="200"/> <el-table-column label="危险类别" align="center" prop="hazardId" width="120">
<el-table-column label="库位" align="center" prop="locationName" min-width="200"/>
<el-table-column label="入库数量" align="center" prop="actualQuantity" min-width="200"/>
<el-table-column label="件数" align="center" prop="actualPackages" min-width="200"/>
<el-table-column label="单价" align="center" prop="unitPrice" min-width="200"/>
<el-table-column label="入库批次物料总价" align="center" prop="totalPrice" min-width="200"/>
<el-table-column label="标签颜色" align="center" prop="labelColor" min-width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag <el-tag
:type="getDictListClass('label_color', scope.row.labelColor)" :type="getDictListClass('danger_type',scope.row.hazardId)"
size="small" size="small">
> {{ getDictLabel('danger_type',scope.row.hazardId) }}
{{ getDictLabel('label_color', scope.row.labelColor) }}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" min-width="200"/> <el-table-column label="规格型号" align="center" prop="specification" width="120" />
<el-table-column label="入库时间" align="center" prop="inboundDate" min-width="200"> <el-table-column label="计量单位" align="center" prop="materialUnit" width="120" />
<el-table-column label="单位重量" align="center" prop="unitWeight" width="120" >
<template slot-scope="scope">
{{ formatAmount(scope.row.unitWeight || 0) }}
</template>
</el-table-column>
<el-table-column label="计划数量" align="center" prop="plannedQuantity" width="100" />
<el-table-column label="实际数量" align="center" prop="actualQuantity" width="100" />
<el-table-column label="总额" align="center" prop="totalPrice" width="100" >
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.inboundDate, '{y}-{m}-{d}') }}</span> {{ formatAmount(scope.row.totalPrice || 0) }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleViewDetail(scope.row)"
>详细</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<!-- 详情弹窗 -->
<el-dialog
title="出库物料详情"
:visible.sync="detailDialogVisible"
width="1400px"
append-to-body
:close-on-click-modal="false"
>
<el-form :model="detailQueryParams" ref="detailQueryForm" size="small" :inline="true" label-width="100px" style="margin-bottom: 15px;">
<el-form-item label="入库日期" prop="inboundDateRange">
<el-date-picker
v-model="inboundDateRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
clearable
/>
</el-form-item>
<el-form-item label="关联入库单号" prop="orderId">
<el-input
v-model="queryParams.orderId"
placeholder="请输入入库单号"
clearable
/>
</el-form-item>
<el-form-item label="批次" prop="batchId">
<el-input
v-model="queryParams.batchId"
placeholder="请输入批次"
clearable
/>
</el-form-item>
<el-form-item label="仓库" prop="warehouseId">
<el-input
v-model="queryWarehouseName"
placeholder="请选择仓库"
readonly
@focus="openWarehouseSelector"
:suffix-icon="''"
>
<template v-if="queryWarehouseName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearQueryWarehouse"
></i>
</template>
</el-input>
</el-form-item>
<el-form-item label="库位" prop="locationId">
<el-input
v-model="queryLocationName"
placeholder="请选择库位"
readonly
@focus="openLocationSelector"
:suffix-icon="''"
>
<template v-if="queryLocationName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearQueryLocation"
></i>
</template>
</el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleDetailQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetDetailQuery">重置</el-button>
</el-form-item>
</el-form>
<div style="max-height: 600px; overflow: auto;">
<el-table
v-loading="detailLoading"
:data="detailList"
border
style="width: 100%"
>
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column label="物料名称" align="center" prop="materialName" min-width="150" show-overflow-tooltip />
<el-table-column label="关联订单号" align="center" prop="orderId" width="150" />
<el-table-column label="批次" align="center" prop="batchId" width="120" />
<el-table-column label="仓库" align="center" prop="warehousesName" width="120" />
<el-table-column label="库位" align="center" prop="locationName" width="120" />
<el-table-column label="计划数量" align="center" prop="plannedQuantity" width="100" />
<el-table-column label="实际数量" align="center" prop="actualQuantity" width="100" />
<el-table-column label="入库日期" align="center" prop="inboundDate" width="120">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.inboundDate,'{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="单价" align="center" prop="unitPrice" width="100">
<template slot-scope="scope">
{{ formatAmount(scope.row.unitPrice || 0) }}
</template>
</el-table-column>
<el-table-column label="金额" align="center" prop="totalPrice" width="120">
<template slot-scope="scope">
{{ formatAmount(scope.row.totalPrice || (scope.row.actualQuantity || 0) * (scope.row.unitPrice || 0)) }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" min-width="150" show-overflow-tooltip />
</el-table>
</div>
<pagination
v-show="detailTotal > 0"
:total="detailTotal"
:page.sync="detailQueryParams.pageNum"
:limit.sync="detailQueryParams.pageSize"
@pagination="getDetailList"
style="margin-top: 15px;"
/>
<div slot="footer" class="dialog-footer">
<el-button @click="detailDialogVisible = false"> </el-button>
</div>
</el-dialog>
<!-- 分页组件 --> <!-- 分页组件 -->
<pagination <pagination
v-show="total>0" v-show="total>0"
...@@ -173,7 +274,6 @@ ...@@ -173,7 +274,6 @@
<!-- 库位选择组件 --> <!-- 库位选择组件 -->
<LocationSelector <LocationSelector
v-model="locationSelectorVisible" v-model="locationSelectorVisible"
@selected="handleLocationSelected" @selected="handleLocationSelected"
/> />
</div> </div>
...@@ -181,7 +281,7 @@ ...@@ -181,7 +281,7 @@
</template> </template>
<script> <script>
import { inbound_details } from "@/api/inventory/inbound_items" import { inbound_details, details_information } from "@/api/inventory/inbound_items"
import PageTitle from "@/components/PageTitle" import PageTitle from "@/components/PageTitle"
import PageWrapperSearch from "@/components/Search/PageWrapperSearch" import PageWrapperSearch from "@/components/Search/PageWrapperSearch"
import WarehouseSelector from "@/views/compononents/WarehouseSelector.vue" import WarehouseSelector from "@/views/compononents/WarehouseSelector.vue"
...@@ -189,7 +289,7 @@ import LocationSelector from "@/views/compononents/LocationSelector.vue" ...@@ -189,7 +289,7 @@ import LocationSelector from "@/views/compononents/LocationSelector.vue"
export default { export default {
name: "InboundDetails", name: "InboundDetails",
dicts: ['label_color'], dicts: ['label_color','danger_type'],
components: { components: {
PageTitle, PageTitle,
PageWrapperSearch, PageWrapperSearch,
...@@ -208,6 +308,7 @@ export default { ...@@ -208,6 +308,7 @@ export default {
queryLocationName: null, queryLocationName: null,
// 遮罩层 // 遮罩层
loading: true, loading: true,
detailLoading: true,
// 选中数组 // 选中数组
ids: [], ids: [],
// 非单个禁用 // 非单个禁用
...@@ -216,6 +317,7 @@ export default { ...@@ -216,6 +317,7 @@ export default {
multiple: true, multiple: true,
// 总条数 // 总条数
total: 0, total: 0,
detailTotal: 0,
// 入库表格数据 // 入库表格数据
inboundList: [], inboundList: [],
// 查询参数 // 查询参数
...@@ -224,14 +326,23 @@ export default { ...@@ -224,14 +326,23 @@ export default {
pageSize: 10, pageSize: 10,
sapNo: null, sapNo: null,
materialName: null, materialName: null,
orderId: null,
batchId: null,
warehouseId: null, warehouseId: null,
locationId: null, locationId: null,
labelColor: null, labelColor: null,
},
detailDialogVisible: false,
detailList: [],
detailQueryParams: {
pageNum: 1,
pageSize: 10,
orderId: null,
materialId: null,
warehouseId: null,
locationId: null,
batchId: null,
inboundDateStart: null, inboundDateStart: null,
inboundDateEnd: null inboundDateEnd: null
} },
} }
}, },
created() { created() {
...@@ -296,6 +407,67 @@ export default { ...@@ -296,6 +407,67 @@ export default {
this.inboundDateRange = null this.inboundDateRange = null
this.handleQuery() this.handleQuery()
}, },
handleViewDetail(row) {
this.currentDetailRow = row
this.detailDialogVisible = true
this.detailQueryParams = {
pageNum: 1,
pageSize: 10,
orderId: null,
materialId: row.materialId,
warehouseId: null,
warehousesCode: null,
locationId: null,
batchId: null,
inboundDateStart: null,
inboundDateStart: null
}
this.detailWarehouseName = null
this.detailLocationName = null
this.detailList = []
this.detailTotal = 0
this.getDetailList()
},
getDetailList() {
this.detailLoading = true
const params = { ...this.detailQueryParams }
params.warehouseId = params.warehouseId || this.queryParams.warehouseId
params.locationId = params.locationId || this.queryParams.locationId
details_information(params).then(response => {
this.detailList = response.rows || []
this.detailTotal = response.total || 0
this.detailLoading = false
}).catch(() => {
this.detailLoading = false
})
},
handleDetailQuery() {
this.detailQueryParams.pageNum = 1
this.getDetailList()
},
resetDetailQuery() {
this.detailQueryParams = {
pageNum: 1,
pageSize: 10,
orderId: null,
materialId: row.materialId,
warehouseId: null,
locationId: null,
batchId: null,
inboundDateStart: null,
inboundDateStart: null
}
this.inboundDateRange = null
this.detailQueryParams.pageNum = 1
this.getDetailList()
},
formatAmount(amount) {
if (amount === null || amount === undefined || isNaN(amount)) {
return '0.00'
}
return parseFloat(amount).toFixed(2)
},
/** 多选框选中数据 */ /** 多选框选中数据 */
handleSelectionChange(selection) { handleSelectionChange(selection) {
...@@ -356,7 +528,7 @@ export default { ...@@ -356,7 +528,7 @@ export default {
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('inventory/inbound/export', { this.download('/inventory/inbound_items/exportDetails', {
...this.queryParams ...this.queryParams
}, `inbound_${new Date().getTime()}.xlsx`) }, `inbound_${new Date().getTime()}.xlsx`)
} }
......
...@@ -806,7 +806,7 @@ export default { ...@@ -806,7 +806,7 @@ export default {
errors.push(`第${index + 1}行:货物不能为空`) errors.push(`第${index + 1}行:货物不能为空`)
} }
if (parseFloat(item.actualQuantity) <= 0) { if (parseFloat(item.actualQuantity) <= 0) {
errors.push(`第${index + 1}实际数量必须大于0`) errors.push(`第${index + 1}行:实际数量必须大于0`)
} }
}) })
return errors return errors
......
...@@ -262,7 +262,8 @@ export default { ...@@ -262,7 +262,8 @@ export default {
}, },
rules: { rules: {
categoryCode: [{required: true, message:'请输入物料分类编码',trigger:'blur'}], categoryCode: [{required: true, message:'请输入物料分类编码',trigger:'blur'}],
categoryName: [{required: true, message:'请输入物料分类名称', trigger:'blur'}] categoryName: [{required: true, message:'请输入物料分类名称', trigger:'blur'}],
sortNo: [{ pattern: /^[0-9]\d*$/, message: '排序号必须为正整数', trigger: 'blur' }]
} }
} }
}, },
......
...@@ -119,19 +119,42 @@ public class InboundOrderItemsController extends BaseController ...@@ -119,19 +119,42 @@ public class InboundOrderItemsController extends BaseController
} }
/** /**
* 导出入库单明细列表
*/
@PreAuthorize("@ss.hasPermi('inventory:inbound_items:export')")
@Log(title = "入库单明细", businessType = BusinessType.EXPORT)
@PostMapping("/exportDetails")
public void exportDetails(HttpServletResponse response, InboundDetailsVO inboundDetailsVO)
{
List<InboundDetailsVO> list = inboundOrderItemsService.exportInboundDetails(inboundDetailsVO);
ExcelUtil<InboundDetailsVO> util = new ExcelUtil<InboundDetailsVO>(InboundDetailsVO.class);
util.exportExcel(response, list, "入库单明细数据");
}
/**
* 统计入库单物料明细 * 统计入库单物料明细
*/ */
@PreAuthorize("@ss.hasPermi('inventory:inbound_items:list')") @PreAuthorize("@ss.hasPermi('inventory:inbound_items:list')")
@GetMapping("/details") @GetMapping("/detailsList")
public TableDataInfo itemDetails(InboundDetailsVO inboundDetailsVO) throws Exception public TableDataInfo itemDetails(InboundDetailsVO inboundDetailsVO) throws Exception
{ {
startPage(); startPage();
System.out.println(inboundDetailsVO);
List<InboundDetailsVO> list = inboundOrderItemsService.selectInboundDetailsVOBySapNo(inboundDetailsVO); List<InboundDetailsVO> list = inboundOrderItemsService.selectInboundDetailsVOBySapNo(inboundDetailsVO);
return getDataTable(list); return getDataTable(list);
} }
/** /**
* 查看明细关联单号批次
*/
@PreAuthorize("@ss.hasPermi('inventory:inbound_items:list')")
@GetMapping("/detailsInformation")
public TableDataInfo itemDetailsByMaterialId(InboundDetailsVO inboundDetailsVO) throws Exception
{
startPage();
List<InboundDetailsVO> list = inboundOrderItemsService.selectDetailsByMaterialId(inboundDetailsVO);
return getDataTable(list);
}
/**
* 导入入库单物料明细 * 导入入库单物料明细
* (暂无用,入库导入功能统一写在inbound主表类中) * (暂无用,入库导入功能统一写在inbound主表类中)
*/ */
......
package com.ruoyi.inventory.domain.vo; package com.ruoyi.inventory.domain.vo;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import java.util.Date; import java.util.Date;
@Data
public class InboundDetailsVO { public class InboundDetailsVO {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// 基础物料字段
private String materialId; private String materialId;
@Excel(name = "物料SAP") @Excel(name = "物料SAP")
...@@ -16,21 +18,44 @@ public class InboundDetailsVO { ...@@ -16,21 +18,44 @@ public class InboundDetailsVO {
@Excel(name = "物料名") @Excel(name = "物料名")
private String materialName; private String materialName;
// 新增:TS编码(来自第一个SQL的m.ts_code)
@Excel(name = "TS编码")
private String tsCode;
// 新增:危险等级ID(来自第一个SQL的m.hazard_id)
@Excel(name = "危险等级ID")
private String hazardId;
// 新增:物料规格(来自第一个SQL的m.specification)
@Excel(name = "物料规格")
private String specification;
// 新增:物料单位(来自第一个SQL的m.material_unit)
@Excel(name = "物料单位")
private String materialUnit;
// 新增:单重(来自第一个SQL的m.unit_weight)
@Excel(name = "物料单重")
private Double unitWeight;
// 新增:计划入库数量(来自第一个SQL的SUM(ioi.planned_quantity))
@Excel(name = "计划入库数量")
private Long plannedQuantity;
@Excel(name = "入库单号") @Excel(name = "入库单号")
private String orderId; private String orderId;
@Excel(name = "批次ID") @Excel(name = "批次ID")
private String batchId; private String batchId;
// @Excel(name = "仓库ID")
private String warehouseId; private String warehouseId;
@Excel(name = "仓库名") @Excel(name = "仓库名")
private String warehousesName; private String warehousesName;
// @Excel(name = "库位ID")
private String locationId; private String locationId;
@Excel(name = "库位名称") // 补充Excel注解
private String locationName; private String locationName;
@Excel(name = "入库数量") @Excel(name = "入库数量")
...@@ -51,175 +76,11 @@ public class InboundDetailsVO { ...@@ -51,175 +76,11 @@ public class InboundDetailsVO {
@Excel(name = "备注") @Excel(name = "备注")
private String remark; private String remark;
@Excel(name = "入库时间") @Excel(name = "入库时间") // 补充日期格式化
private Date inboundDate; private Date inboundDate;
// 开始入库日期结束日库日期,仅作查询
private Date inboundDateStart;
private Date inboundDateEnd;
public String getMaterialId() {
return materialId;
}
public void setMaterialId(String materialId) {
this.materialId = materialId;
}
public String getMaterialName() { // 查询条件字段(无需Excel注解)
return materialName; private Date inboundDateStart;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public String getBatchId() {
return batchId;
}
public void setBatchId(String batchId) {
this.batchId = batchId;
}
public String getWarehouseId() {
return warehouseId;
}
public void setWarehouseId(String warehouseId) {
this.warehouseId = warehouseId;
}
public String getLocationId() {
return locationId;
}
public void setLocationId(String locationId) {
this.locationId = locationId;
}
public Long getActualQuantity() { private Date inboundDateEnd;
return actualQuantity;
}
public void setActualQuantity(Long actualQuantity) {
this.actualQuantity = actualQuantity;
}
public Long getActualPackages() {
return actualPackages;
}
public void setActualPackages(Long actualPackages) {
this.actualPackages = actualPackages;
}
public String getLabelColor() {
return labelColor;
}
public void setLabelColor(String labelColor) {
this.labelColor = labelColor;
}
public Double getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(Double unitPrice) {
this.unitPrice = unitPrice;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Double getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(Double totalPrice) {
this.totalPrice = totalPrice;
}
public Date getInboundDate() {
return inboundDate;
}
public void setInboundDate(Date inboundDate) {
this.inboundDate = inboundDate;
}
public String getWarehousesName() {
return warehousesName;
}
public void setWarehousesName(String warehousesName) {
this.warehousesName = warehousesName;
}
public String getLocationName() {
return locationName;
}
public void setLocationName(String locationName) {
this.locationName = locationName;
}
public String getSapNo() {
return sapNo;
}
public void setSapNo(String sapNo) {
this.sapNo = sapNo;
}
public Date getInboundDateStart() {
return inboundDateStart;
}
public void setInboundDateStart(Date inboundDateStart) {
this.inboundDateStart = inboundDateStart;
}
public Date getInboundDateEnd() {
return inboundDateEnd;
}
public void setInboundDateEnd(Date inboundDateEnd) {
this.inboundDateEnd = inboundDateEnd;
}
@Override
public String toString() {
return "InboundDetailsVO{" +
"materialId='" + materialId + '\'' +
", sapNo='" + sapNo + '\'' +
", materialName='" + materialName + '\'' +
", orderId='" + orderId + '\'' +
", batchId='" + batchId + '\'' +
", warehouseId='" + warehouseId + '\'' +
", warehousesName='" + warehousesName + '\'' +
", locationId='" + locationId + '\'' +
", locationName='" + locationName + '\'' +
", actualQuantity=" + actualQuantity +
", actualPackages=" + actualPackages +
", labelColor='" + labelColor + '\'' +
", unitPrice=" + unitPrice +
", totalPrice=" + totalPrice +
", remark='" + remark + '\'' +
", inboundDate=" + inboundDate +
'}';
}
} }
...@@ -69,8 +69,19 @@ public interface InboundOrderItemsMapper ...@@ -69,8 +69,19 @@ public interface InboundOrderItemsMapper
public int deleteInboundOrderItemsByIds(String[] ids); public int deleteInboundOrderItemsByIds(String[] ids);
/** /**
* 导出入库单明细
* @return 结果
*/
public List<InboundDetailsVO> exportInboundDetails(InboundDetailsVO inboundDetailsVO);
/**
* 统计入库单明细 * 统计入库单明细
* @return 结果 * @return 结果
*/ */
public List<InboundDetailsVO> selectInboundDetailsVOBySapNo(InboundDetailsVO inboundDetailsVO); public List<InboundDetailsVO> selectInboundDetailsVOBySapNo(InboundDetailsVO inboundDetailsVO);
/**
* 查看明细相关单号批次号等信息
* @return 结果
*/
public List<InboundDetailsVO> selectDetailsByMaterialId(InboundDetailsVO inboundDetailsVO);
} }
...@@ -79,8 +79,20 @@ public interface IInboundOrderItemsService ...@@ -79,8 +79,20 @@ public interface IInboundOrderItemsService
public String importInboundOrderItems(List<InboundOrderItems> inboundOrderItems, Boolean isUpdateSupport, String operName); public String importInboundOrderItems(List<InboundOrderItems> inboundOrderItems, Boolean isUpdateSupport, String operName);
/** /**
* 导出入库单明细
* @return 结果
*/
public List<InboundDetailsVO> exportInboundDetails(InboundDetailsVO inboundDetailsVO);
/**
* 统计入库单明细 * 统计入库单明细
* @return 结果 * @return 结果
*/ */
public List<InboundDetailsVO> selectInboundDetailsVOBySapNo(InboundDetailsVO inboundDetailsVO); public List<InboundDetailsVO> selectInboundDetailsVOBySapNo(InboundDetailsVO inboundDetailsVO);
/**
* 查看明细相关单号批次号等信息
* @return 结果
*/
public List<InboundDetailsVO> selectDetailsByMaterialId(InboundDetailsVO inboundDetailsVO);
} }
...@@ -179,7 +179,17 @@ public class InboundOrderItemsServiceImpl implements IInboundOrderItemsService ...@@ -179,7 +179,17 @@ public class InboundOrderItemsServiceImpl implements IInboundOrderItemsService
} }
@Override @Override
public List<InboundDetailsVO> exportInboundDetails(InboundDetailsVO inboundDetailsVO) {
return inboundOrderItemsMapper.exportInboundDetails(inboundDetailsVO);
}
@Override
public List<InboundDetailsVO> selectInboundDetailsVOBySapNo(InboundDetailsVO inboundDetailsVO) { public List<InboundDetailsVO> selectInboundDetailsVOBySapNo(InboundDetailsVO inboundDetailsVO) {
return inboundOrderItemsMapper.selectInboundDetailsVOBySapNo(inboundDetailsVO); return inboundOrderItemsMapper.selectInboundDetailsVOBySapNo(inboundDetailsVO);
} }
@Override
public List<InboundDetailsVO> selectDetailsByMaterialId(InboundDetailsVO inboundDetailsVO) {
return inboundOrderItemsMapper.selectDetailsByMaterialId(inboundDetailsVO);
}
} }
...@@ -322,73 +322,144 @@ ...@@ -322,73 +322,144 @@
</foreach> </foreach>
</delete> </delete>
<!-- 入库统计的表格查询sql和映射字段 --> <!-- 入库统计页面的表格查询sql和映射字段 -->
<resultMap id="InboundDetailsResultMap" type="com.ruoyi.inventory.domain.vo.InboundDetailsVO"> <resultMap id="InboundDetailsResultMap" type="com.ruoyi.inventory.domain.vo.InboundDetailsVO">
<!-- 基础字段映射 --> <!-- 基础物料字段 -->
<result column="material_id" property="materialId" jdbcType="VARCHAR" /> <result column="material_id" property="materialId" jdbcType="VARCHAR" />
<result column="sap_no" property="sapNo" jdbcType="VARCHAR" /> <result column="sap_no" property="sapNo" jdbcType="VARCHAR" />
<result column="material_name" property="materialName" jdbcType="VARCHAR" /> <result column="material_name" property="materialName" jdbcType="VARCHAR" />
<!-- 新增:TS编码映射 -->
<result column="ts_code" property="tsCode" jdbcType="VARCHAR" />
<!-- 新增:危险等级ID映射 -->
<result column="hazard_id" property="hazardId" jdbcType="VARCHAR" />
<!-- 新增:物料规格映射 -->
<result column="specification" property="specification" jdbcType="VARCHAR" />
<!-- 新增:物料单位映射 -->
<result column="material_unit" property="materialUnit" jdbcType="VARCHAR" />
<!-- 新增:单重映射 -->
<result column="unit_weight" property="unitWeight" jdbcType="DOUBLE" />
<!-- 新增:计划入库数量映射 -->
<result column="planned_quantity" property="plannedQuantity" jdbcType="BIGINT" />
<!-- 入库单/批次/仓库/库位字段 -->
<result column="order_id" property="orderId" jdbcType="VARCHAR" /> <result column="order_id" property="orderId" jdbcType="VARCHAR" />
<result column="batch_id" property="batchId" jdbcType="VARCHAR" /> <result column="batch_id" property="batchId" jdbcType="VARCHAR" />
<result column="warehouse_id" property="warehouseId" jdbcType="VARCHAR" /> <result column="warehouse_id" property="warehouseId" jdbcType="VARCHAR" />
<result column="warehouses_name" property="warehousesName" jdbcType="VARCHAR" /> <result column="warehouses_name" property="warehousesName" jdbcType="VARCHAR" />
<result column="location_id" property="locationId" jdbcType="VARCHAR"/> <result column="location_id" property="locationId" jdbcType="VARCHAR"/>
<result column="location_name" property="locationName" jdbcType="VARCHAR" /> <result column="location_name" property="locationName" jdbcType="VARCHAR" />
<!-- 数值型字段 --> <!-- 数值型字段 -->
<result column="actual_quantity" property="actualQuantity" jdbcType="BIGINT" /> <result column="actual_quantity" property="actualQuantity" jdbcType="BIGINT" />
<result column="actual_packages" property="actualPackages" jdbcType="BIGINT" /> <result column="actual_packages" property="actualPackages" jdbcType="BIGINT" />
<!-- 字符串/枚举类字段 --> <!-- 字符串字段 -->
<result column="label_color" property="labelColor" jdbcType="VARCHAR" /> <result column="label_color" property="labelColor" jdbcType="VARCHAR" />
<!-- 金额字段 --> <!-- 金额字段 -->
<result column="unit_price" property="unitPrice" jdbcType="DOUBLE" /> <result column="unit_price" property="unitPrice" jdbcType="DOUBLE" />
<result column="total_price" property="totalPrice" jdbcType="DOUBLE" /> <result column="total_price" property="totalPrice" jdbcType="DOUBLE" />
<!-- 备注字段 --> <!-- 备注&日期字段 -->
<result column="remark" property="remark" jdbcType="VARCHAR" /> <result column="remark" property="remark" jdbcType="VARCHAR" />
<!-- 日期字段(指定日期格式化) --> <result column="inbound_date" property="inboundDate" />
<result column="inbound_date" property="inboundDate"/>
</resultMap> </resultMap>
<select id="selectInboundDetailsVOBySapNo" resultMap="InboundDetailsResultMap" parameterType="com.ruoyi.inventory.domain.vo.InboundDetailsVO"> <select id="selectInboundDetailsVOBySapNo" resultMap="InboundDetailsResultMap" parameterType="com.ruoyi.inventory.domain.vo.InboundDetailsVO">
SELECT SELECT
ioi.material_id, ioi.material_id,
ms.sap_no, m.sap_no,
ms.material_name, m.material_name,
m.ts_code,
m.hazard_id,
m.specification,
m.material_unit,
m.unit_weight,
SUM(ioi.planned_quantity) AS planned_quantity,
SUM(ioi.actual_quantity) AS actual_quantity,
SUM(ioi.actual_packages) AS actual_packages,
ioi.unit_price,
SUM(ioi.unit_price * ioi.actual_quantity) AS total_price
FROM inbound_order_items as ioi
left join materials as m on ioi.material_id = m.id
left join inbound_orders as io on ioi.inbound_order_id = io.id
<where>
io.order_status = 2
<!-- <if test="inboundDateStart != null">-->
<!-- AND DATE(io.inbound_date) &gt;= #{inboundDateStart}-->
<!-- </if>-->
<!-- <if test="inboundDateEnd != null">-->
<!-- AND DATE(io.inbound_date) &lt;= #{inboundDateEnd}-->
<!-- </if>-->
<if test="sapNo != null and sapNo != ''">
AND m.sap_no like concat('%', #{sapNo}, '%')
</if>
<if test="materialName != null and materialName != ''">
AND m.material_name LIKE CONCAT('%', #{materialName}, '%')
</if>
<if test="orderId != null and orderId != ''">
AND ioi.order_id like concat('%', #{orderId}, '%')
</if>
<if test="batchId != null and batchId != ''">
AND ioi.batch_id like concat('%', #{batchId}, '%')
</if>
<if test="warehouseId != null and warehouseId != ''">
AND ioi.warehouse_id = #{warehouseId}
</if>
<if test="locationId != null and locationId != ''">
AND ioi.location_id = #{locationId}
</if>
<if test="labelColor != null and labelColor != ''">
AND ioi.label_color = #{labelColor}
</if>
</where>
GROUP BY
ioi.material_id,
ioi.unit_price,
m.sap_no,
m.material_name,
m.ts_code,
m.hazard_id,
m.specification,
m.material_unit,
m.unit_weight
order by ioi.material_id asc
</select>
<!-- 入库统计点击明细查看该物料的关联入库单和批次-->
<select id="selectDetailsByMaterialId" parameterType="com.ruoyi.inventory.domain.vo.InboundDetailsVO" resultMap="InboundDetailsResultMap">
SELECT
ioi.material_id,
m.material_name,
ioi.order_id, ioi.order_id,
ioi.batch_id, ioi.batch_id,
ioi.warehouse_id, ioi.warehouse_id,
w.warehouses_name, w.warehouses_name,
ioi.location_id, ioi.location_id,
sl.location_name, sl.location_name,
SUM(ioi.actual_quantity) AS actual_quantity, ioi.planned_quantity,
SUM(ioi.actual_packages) AS actual_packages, ioi.actual_quantity,
ioi.label_color,
ioi.unit_price, ioi.unit_price,
SUM(ioi.unit_price * ioi.actual_quantity) AS total_price, SUM(ioi.unit_price * ioi.actual_quantity) AS total_price,
ioi.remark, ioi.remark,
io.inbound_date io.inbound_date
FROM inbound_orders io FROM inbound_order_items ioi
INNER JOIN inbound_order_items ioi ON io.id = ioi.inbound_order_id left join materials m ON m.id = ioi.material_id
INNER JOIN materials ms ON ms.id = ioi.material_id left join inbound_orders io ON io.id = ioi.inbound_order_id
left join warehouses w on ioi.warehouse_id = w.id left join warehouses w on ioi.warehouse_id = w.id
left join storage_locations sl on ioi.location_id = sl.id left join storage_locations sl on ioi.location_id = sl.id
<where> <where>
io.order_status = 2 io.order_status = 2
<if test="materialId != null and materialId != ''">
AND ioi.material_id = #{materialId}
</if>
<if test="inboundDateStart != null"> <if test="inboundDateStart != null">
AND DATE(io.inbound_date) &gt;= #{inboundDateStart} AND DATE(io.inbound_date) &gt;= #{inboundDateStart}
</if> </if>
<if test="inboundDateEnd != null"> <if test="inboundDateEnd != null">
AND DATE(io.inbound_date) &lt;= #{inboundDateEnd} AND DATE(io.inbound_date) &lt;= #{inboundDateEnd}
</if> </if>
<if test="sapNo != null and sapNo != ''">
AND ms.sap_no like concat('%', #{sapNo}, '%')
</if>
<if test="materialName != null and materialName != ''">
AND ms.material_name LIKE CONCAT('%', #{materialName}, '%')
</if>
<if test="orderId != null and orderId != ''"> <if test="orderId != null and orderId != ''">
AND ioi.order_id like concat('%', #{orderId}, '%') AND ioi.order_id like concat('%', #{orderId}, '%')
</if> </if>
...@@ -401,21 +472,92 @@ ...@@ -401,21 +472,92 @@
<if test="locationId != null and locationId != ''"> <if test="locationId != null and locationId != ''">
AND ioi.location_id = #{locationId} AND ioi.location_id = #{locationId}
</if> </if>
<if test="labelColor != null and labelColor != ''">
AND ioi.label_color = #{labelColor}
</if>
</where> </where>
GROUP BY GROUP BY
ioi.material_id, ioi.material_id,
ioi.batch_id, ioi.batch_id,
ioi.warehouse_id, ioi.warehouse_id,
ioi.location_id, ioi.location_id,
ms.material_name,
ioi.order_id, ioi.order_id,
ioi.label_color,
ioi.unit_price, ioi.unit_price,
ioi.remark, ioi.remark,
io.inbound_date io.inbound_date
order by date(inbound_date) desc,ioi.order_id asc,ioi.material_id asc order by date(inbound_date) desc
</select>
<select id="exportInboundDetails" resultMap="InboundDetailsResultMap" parameterType="com.ruoyi.inventory.domain.vo.InboundDetailsVO">
SELECT
ioi.material_id,
m.sap_no,
m.material_name,
m.ts_code,
m.hazard_id,
m.specification,
m.material_unit,
m.unit_weight,
ioi.order_id,
ioi.batch_id,
ioi.warehouse_id,
w.warehouses_name,
ioi.location_id,
sl.location_name,
ioi.remark,
io.inbound_date,
SUM(ioi.planned_quantity) AS planned_quantity,
SUM(ioi.actual_quantity) AS actual_quantity,
SUM(ioi.actual_packages) AS actual_packages,
ioi.unit_price,
SUM(ioi.unit_price * ioi.actual_quantity) AS total_price
FROM inbound_order_items as ioi
LEFT JOIN materials as m ON ioi.material_id = m.id
LEFT JOIN inbound_orders as io ON ioi.inbound_order_id = io.id
LEFT JOIN warehouses w ON ioi.warehouse_id = w.id
LEFT JOIN storage_locations sl ON ioi.location_id = sl.id
<where>
io.order_status = 2
<if test="sapNo != null and sapNo != ''">
AND m.sap_no like concat('%', #{sapNo}, '%')
</if>
<if test="materialName != null and materialName != ''">
AND m.material_name LIKE CONCAT('%', #{materialName}, '%')
</if>
<if test="warehouseId != null and warehouseId != ''">
AND ioi.warehouse_id = #{warehouseId}
</if>
<if test="locationId != null and locationId != ''">
AND ioi.location_id = #{locationId}
</if>
<if test="labelColor != null and labelColor != ''">
AND ioi.label_color = #{labelColor}
</if>
</where>
GROUP BY
ioi.material_id,
m.sap_no,
m.material_name,
m.ts_code,
m.hazard_id,
m.specification,
m.material_unit,
m.unit_weight,
ioi.order_id,
ioi.batch_id,
ioi.warehouse_id,
w.warehouses_name,
ioi.location_id,
sl.location_name,
ioi.remark,
io.inbound_date,
ioi.unit_price
ORDER BY DATE(io.inbound_date) DESC, ioi.material_id ASC
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -38,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -38,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectMaterialsVo"> <sql id="selectMaterialsVo">
select id, material_code, material_name,material_ename, sap_no, ts_code, category_code, hazard_id, specification, material_unit, unit_weight, package_weight, total_weight, volume, shelf_life_days, storage_temperature, special_requirements, is_batch_managed, is_serial_managed, min_stock_level, max_stock_level, is_used, is_active, risk_level, sort_no, create_time, create_user_code, update_time, update_user_code from materials select id, material_code, material_name, material_ename, sap_no, ts_code, category_code, hazard_id, specification, material_unit, unit_weight, package_weight, total_weight, volume, shelf_life_days, storage_temperature, special_requirements, is_batch_managed, is_serial_managed, min_stock_level, max_stock_level, is_used, is_active, risk_level, sort_no, create_time, create_user_code, update_time, update_user_code from materials
</sql> </sql>
<select id="selectMaterialsList" parameterType="Materials" resultMap="MaterialsResult"> <select id="selectMaterialsList" parameterType="Materials" resultMap="MaterialsResult">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论