Commit 4d6ba55f by wangchunyang
parents 696c8784 14445f3b
...@@ -7,19 +7,43 @@ ...@@ -7,19 +7,43 @@
:limit="1" :limit="1"
accept=".xlsx, .xls" accept=".xlsx, .xls"
:headers="upload.headers" :headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport" :action="upload.url"
:disabled="upload.isUploading" :disabled="upload.isUploading"
:on-progress="handleFileUploadProgress" :on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess" :on-success="handleFileSuccess"
:auto-upload="false" :auto-upload="false"
:data="getUploadData()"
drag drag
> >
<i class="el-icon-upload"></i> <i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip"> <div class="el-upload__tip text-center" slot="tip">
<div class="el-upload__tip" slot="tip"> <div
<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的数据 class="order-type-radio"
v-if="showTrdcCheckbox && dict.type.inbound_outbound_type.length"
style="margin-bottom: 8px; text-align: left; padding-left: 20px;"
>
<el-radio-group v-model="upload.orderType">
<el-radio
v-for="item in dict.type.inbound_outbound_type"
:key="item.value"
:label="item.value"
style="margin-right: 20px;"
>
{{ item.label }}
</el-radio>
</el-radio-group>
</div>
<!-- 加载中提示 -->
<div
v-else-if="showTrdcCheckbox && !dict.type.inbound_outbound_type.length"
style="margin-bottom: 8px; text-align: left; padding-left: 20px;"
>
<i class="el-icon-loading" style="font-size: 14px;"></i> 加载入库类型...
</div> </div>
<!-- <div class="el-upload__tip" slot="tip">
<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的数据
</div> -->
<span>仅允许导入xls、xlsx格式文件。</span> <span>仅允许导入xls、xlsx格式文件。</span>
<el-link <el-link
type="primary" type="primary"
...@@ -42,6 +66,7 @@ import { getToken } from "@/utils/auth" ...@@ -42,6 +66,7 @@ import { getToken } from "@/utils/auth"
export default { export default {
name: "ImportExcel", name: "ImportExcel",
dicts: ['inbound_outbound_type'],
props: { props: {
// 导入标题 // 导入标题
title: { title: {
...@@ -62,6 +87,15 @@ export default { ...@@ -62,6 +87,15 @@ export default {
templateName: { templateName: {
type: String, type: String,
default: "template" default: "template"
},
showTrdcCheckbox: {
type: Boolean,
default: false
},
// 新增:是否要求orderType为必传项
orderTypeRequired: {
type: Boolean,
default: false
} }
}, },
data() { data() {
...@@ -79,7 +113,26 @@ export default { ...@@ -79,7 +113,26 @@ export default {
// 设置上传的请求头部 // 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() }, headers: { Authorization: "Bearer " + getToken() },
// 上传的地址 // 上传的地址
url: "" url: "",
// 入库类型字段
orderType: ""
}
}
},
watch: {
// 监听orderType变化,实时传递给父组件
"upload.orderType": {
handler(newVal) {
this.$emit("orderTypeChange", newVal)
},
immediate: true
},
// 监听弹窗打开,设置单选框默认值
"upload.open"(val) {
if (val && this.showTrdcCheckbox) {
// 取字典第一个作为默认值
const defaultType = this.dict.type.inbound_outbound_type[0]?.value || ""
this.upload.orderType = defaultType
} }
} }
}, },
...@@ -89,6 +142,12 @@ export default { ...@@ -89,6 +142,12 @@ export default {
this.upload.title = this.title this.upload.title = this.title
this.upload.url = process.env.VUE_APP_BASE_API + this.importUrl this.upload.url = process.env.VUE_APP_BASE_API + this.importUrl
this.upload.open = true this.upload.open = true
// 恢复原有重置
this.upload.updateSupport = 0
// 重置入库类型
this.upload.orderType = this.showTrdcCheckbox
? (this.dict.type.inbound_outbound_type[0]?.value || "")
: ""
}, },
/** 下载模板操作 */ /** 下载模板操作 */
importTemplate() { importTemplate() {
...@@ -111,7 +170,21 @@ export default { ...@@ -111,7 +170,21 @@ export default {
{ dangerouslyUseHTMLString: true } { dangerouslyUseHTMLString: true }
) )
// 触发父组件的成功回调 // 触发父组件的成功回调
this.$emit("success") this.$emit("success", {
orderType: this.upload.orderType,
updateSupport: this.upload.updateSupport
})
},
// 返回要追加到FormData的参数
getUploadData() {
const data = {
updateSupport: this.upload.updateSupport
};
// 如果显示单选框,追加orderType到FormData
if (this.showTrdcCheckbox) {
data.orderType = this.upload.orderType;
}
return data;
}, },
// 提交上传文件 // 提交上传文件
submitFileForm() { submitFileForm() {
...@@ -125,6 +198,14 @@ export default { ...@@ -125,6 +198,14 @@ export default {
this.$modal.msgError("请选择后缀为 “xls”或“xlsx”的文件。") this.$modal.msgError("请选择后缀为 “xls”或“xlsx”的文件。")
return return
} }
// 校验orderType(如果是必传项)
if (this.showTrdcCheckbox && this.orderTypeRequired && !this.upload.orderType) {
this.$modal.msgError("请选择入库/出库类型!")
return
}
// 提交前通知父组件
this.$emit("orderTypeChange", this.upload.orderType)
// 提交上传
this.$refs.upload.submit() this.$refs.upload.submit()
} }
} }
...@@ -132,4 +213,5 @@ export default { ...@@ -132,4 +213,5 @@ export default {
</script> </script>
<style scoped> <style scoped>
</style> </style>
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
@search="handleQuery" @search="handleQuery"
@reset="resetQuery" @reset="resetQuery"
> >
<el-form-item label="物料SAPNO" prop="materialId"> <el-form-item label="物料SAPNO" prop="sapNo">
<el-input <el-input
v-model="queryParams.materialId" v-model="queryParams.sapNo"
placeholder="请输入物料SAPNO" placeholder="请输入物料SAPNO"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
:row-key="(row) => row.materialId + '_' + row.orderId" :row-key="(row) => row.materialId + '_' + row.orderId"
> >
<el-table-column label="物料SAPNO" align="center" prop="materialId" width="200"/> <el-table-column label="物料SAPNO" align="center" prop="sapNo" width="200"/>
<el-table-column label="物料名称" align="center" prop="materialName" width="200"/> <el-table-column label="物料名称" align="center" prop="materialName" width="200"/>
<el-table-column label="关联入库单ID" align="center" prop="orderId" :show-overflow-tooltip="true" width="200"/> <el-table-column label="关联入库单ID" align="center" prop="orderId" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="批次ID" align="center" prop="batchId" :show-overflow-tooltip="true" width="200"/> <el-table-column label="批次ID" align="center" prop="batchId" :show-overflow-tooltip="true" width="200"/>
......
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
<el-form-item label="入库类型" prop="orderTypeId"> <el-form-item label="入库类型" prop="orderTypeId">
<el-select v-model="queryParams.orderTypeId" placeholder="请选择入库类型" clearable> <el-select v-model="queryParams.orderTypeId" placeholder="请选择入库类型" clearable>
<el-option <el-option
v-for="dict in dict.type.inbound_type" v-for="dict in dict.type.inbound_outbound_type"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
...@@ -152,9 +152,9 @@ ...@@ -152,9 +152,9 @@
<el-table-column label="入库类型" align="center" prop="orderTypeId" :show-overflow-tooltip="true" width="200"> <el-table-column label="入库类型" align="center" prop="orderTypeId" :show-overflow-tooltip="true" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag <el-tag
:type="getDictListClass('inbound_type',scope.row.orderTypeId)" :type="getDictListClass('inbound_outbound_type',scope.row.orderTypeId)"
size="small"> size="small">
{{ getDictLabel('inbound_type',scope.row.orderTypeId) }} {{ getDictLabel('inbound_outbound_type',scope.row.orderTypeId) }}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
...@@ -162,9 +162,9 @@ ...@@ -162,9 +162,9 @@
<el-table-column label="订单类型" align="center" prop="orderType" :show-overflow-tooltip="true" width="200"> <el-table-column label="订单类型" align="center" prop="orderType" :show-overflow-tooltip="true" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag <el-tag
:type="getDictListClass('order_type',scope.row.orderTypeId)" :type="getDictListClass('order_type',scope.row.orderType)"
size="small"> size="small">
{{ getDictLabel('order_type',scope.row.orderTypeId) }} {{ getDictLabel('order_type',scope.row.orderType) }}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
<el-form-item label="入库类型" prop="orderTypeId"> <el-form-item label="入库类型" prop="orderTypeId">
<el-select v-model="form.orderTypeId" placeholder="请选择入库类型" clearable> <el-select v-model="form.orderTypeId" placeholder="请选择入库类型" clearable>
<el-option <el-option
v-for="dict in dict.type.inbound_type" v-for="dict in dict.type.inbound_outbound_type"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
...@@ -384,13 +384,13 @@ ...@@ -384,13 +384,13 @@
<el-descriptions-item label="批次ID">{{ detailForm.batchId || '-' }}</el-descriptions-item> <el-descriptions-item label="批次ID">{{ detailForm.batchId || '-' }}</el-descriptions-item>
<el-descriptions-item label="货主">{{ detailForm.ownerName || detailForm.ownerId || '-' }}</el-descriptions-item> <el-descriptions-item label="货主">{{ detailForm.ownerName || detailForm.ownerId || '-' }}</el-descriptions-item>
<el-descriptions-item label="入库类型"> <el-descriptions-item label="入库类型">
{{ getDictLabel('inbound_type',detailForm.orderTypeId) }} {{ getDictLabel('inbound_outbound_type',detailForm.orderTypeId) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="订单类型"> <el-descriptions-item label="订单类型">
{{ getDictLabel('order_type',detailForm.orderType) }} {{ getDictLabel('order_type',detailForm.orderType) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="入库日期">{{ detailForm.inboundDate || '-' }}</el-descriptions-item> <el-descriptions-item label="入库日期">{{ detailForm.inboundDate || '-' }}</el-descriptions-item>
<el-descriptions-item label="负责人">{{ detailForm.opUserName || '-' }}</el-descriptions-item> <!-- <el-descriptions-item label="负责人">{{ detailForm.opUserName || '-' }}</el-descriptions-item> -->
<el-descriptions-item label="计划量">{{ detailForm.totalPlannedQuantity || '-' }}</el-descriptions-item> <el-descriptions-item label="计划量">{{ detailForm.totalPlannedQuantity || '-' }}</el-descriptions-item>
<el-descriptions-item label="实际量">{{ detailForm.totalActualQuantity || '-' }}</el-descriptions-item> <el-descriptions-item label="实际量">{{ detailForm.totalActualQuantity || '-' }}</el-descriptions-item>
<!-- <el-descriptions-item label="总件数">{{ detailForm.totalPackages || '-' }}</el-descriptions-item> --> <!-- <el-descriptions-item label="总件数">{{ detailForm.totalPackages || '-' }}</el-descriptions-item> -->
...@@ -445,6 +445,9 @@ ...@@ -445,6 +445,9 @@
template-url="/inventory/inbound/importTemplate" template-url="/inventory/inbound/importTemplate"
template-name="入库单导入模板" template-name="入库单导入模板"
@success="getList" @success="getList"
:show-trdc-checkbox="true"
@orderTypeChange="handleOrderTypeChange"
:orderTypeRequired="true"
/> />
<OwnerSelector <OwnerSelector
v-model="ownerSelectorVisible" v-model="ownerSelectorVisible"
...@@ -466,7 +469,7 @@ ...@@ -466,7 +469,7 @@
<script> <script>
import { listInbound, getInbound, delInbound, addInbound, updateInbound } from "@/api/inventory/inbound" import { listInbound, getInbound, delInbound, addInbound, updateInbound } from "@/api/inventory/inbound"
import { listInbound_items } from "@/api/inventory/inbound_items" import { listInbound_itemsAndMname } from "@/api/inventory/inbound_items"
import { batchAddInventory } from "@/api/inventory/inventory" import { batchAddInventory } from "@/api/inventory/inventory"
import InboundItems from "@/views/inventory/inbound_items/index.vue" import InboundItems from "@/views/inventory/inbound_items/index.vue"
import PageTitle from "@/components/PageTitle" // 引入字典页面的标题组件 import PageTitle from "@/components/PageTitle" // 引入字典页面的标题组件
...@@ -479,7 +482,7 @@ import LocationSelector from "@/views/compononents/LocationSelector.vue" ...@@ -479,7 +482,7 @@ import LocationSelector from "@/views/compononents/LocationSelector.vue"
export default { export default {
name: "Inbound", name: "Inbound",
dicts: ['inbound_type','order_type','inbound_status'], dicts: ['inbound_outbound_type','order_type','inbound_status'],
components: { components: {
InboundItems, InboundItems,
PageTitle, PageTitle,
...@@ -621,6 +624,9 @@ export default { ...@@ -621,6 +624,9 @@ export default {
this.loading = false this.loading = false
}) })
}, },
handleOrderTypeChange(selection) {
this.form.orderTypeId = selection
},
/** 获取状态样式类型 */ /** 获取状态样式类型 */
getStatusType(status) { getStatusType(status) {
const item = this.inBoundStatusOptions.find(item => item.orderStatus === status) const item = this.inBoundStatusOptions.find(item => item.orderStatus === status)
...@@ -658,7 +664,7 @@ export default { ...@@ -658,7 +664,7 @@ export default {
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.$refs.queryForm?.resetFields() // this.$refs.queryForm?.resetFields()
this.queryOwnerName = null this.queryOwnerName = null
this.queryParams = { this.queryParams = {
pageNum: 1, pageNum: 1,
...@@ -674,7 +680,10 @@ export default { ...@@ -674,7 +680,10 @@ export default {
orderStatus: null, orderStatus: null,
orderType: null orderType: null
} }
this.$nextTick(() => {
// 重新触发查询,加载默认数据
this.handleQuery() this.handleQuery()
})
}, },
/** 多选框选中数据 */ /** 多选框选中数据 */
...@@ -845,13 +854,14 @@ export default { ...@@ -845,13 +854,14 @@ export default {
// 将选中的物料添加到入库明细 // 将选中的物料添加到入库明细
this.selectedMaterials.forEach(material => { this.selectedMaterials.forEach(material => {
// 检查是否已存在该物料,避免重复添加 // 检查是否已存在该物料,避免重复添加
const exists = this.form.inboundOrderItemsList.some( // const exists = this.form.inboundOrderItemsList.some(
item => item.materialId === material.sapNo // item => item.materialId === material.materialId
) // )
const exists = false
if (!exists) { if (!exists) {
this.form.inboundOrderItemsList.push({ this.form.inboundOrderItemsList.push({
materialId: material.sapNo, // 存储物料编码 materialId: material.id,
sapNo: material.sapNo,
materialName: material.materialName, // 仅用于展示 materialName: material.materialName, // 仅用于展示
batchCode: null, batchCode: null,
warehouseId: null, warehouseId: null,
...@@ -864,7 +874,7 @@ export default { ...@@ -864,7 +874,7 @@ export default {
totalAmount: 0 totalAmount: 0
}) })
} else { } else {
this.$message.warning(`物料 ${material.materialName} 已存在,跳过添加`) // this.$message.warning(`物料 ${material.materialName} 已存在,跳过添加`)
} }
}) })
this.materialSelectOpen = false this.materialSelectOpen = false
...@@ -887,14 +897,25 @@ export default { ...@@ -887,14 +897,25 @@ export default {
pageSize: 9999, pageSize: 9999,
orderId: row.orderId orderId: row.orderId
} }
const response = await listInbound_items(queryForm) const response = await listInbound_itemsAndMname(queryForm)
row.inboundOrderItemsList = response.rows console.log(response.rows)
row.inboundOrderItemsList = response.rows.map(item => {
return {
...item,
inventoryType: row.orderTypeId,
warehousesId: item.warehouseId,
ownerId: row.ownerId,
quantity: item.actualQuantity,
unitWeight: item.unitWeight
};
})
console.log(row.inboundOrderItemsList)
// 第三步:确保数据存在后调用入库接口 // 第三步:确保数据存在后调用入库接口
if (!row.inboundOrderItemsList || row.inboundOrderItemsList.length === 0) { if (!row.inboundOrderItemsList || row.inboundOrderItemsList.length === 0) {
this.$message.warning('暂无入库明细数据,无法确认入库') this.$message.warning('暂无入库明细数据,无法确认入库')
return return
} }
await batchAddInventory(row.inboundOrderItemsList) await batchAddInventory(row.inboundOrderItemsList)
// 第四步:操作成功提示 // 第四步:操作成功提示
......
...@@ -339,7 +339,7 @@ export default { ...@@ -339,7 +339,7 @@ export default {
columns: { columns: {
type: Array, type: Array,
default: () => [ default: () => [
{ prop: 'materialId', label: '货物ID', width: '150', editable: false }, { prop: 'sapNo', label: 'SapNo', width: '150', editable: false },
{ prop: 'materialName', label: '货物名称', width: '150', editable: false }, { prop: 'materialName', label: '货物名称', width: '150', editable: false },
{ {
prop: 'warehousesName', prop: 'warehousesName',
...@@ -424,6 +424,8 @@ export default { ...@@ -424,6 +424,8 @@ export default {
this.cachedData = JSON.parse(JSON.stringify(newVal || [])) this.cachedData = JSON.parse(JSON.stringify(newVal || []))
this.displayData = (newVal || []).map(item => ({ this.displayData = (newVal || []).map(item => ({
...item, ...item,
sapNo: item.sapNo, // 确保sapNo字段被保存
materialName: item.materialName, // 确保materialName字段被保存
editable: false, editable: false,
tempId: item.id || Date.now() + Math.random() tempId: item.id || Date.now() + Math.random()
})) }))
...@@ -497,10 +499,9 @@ export default { ...@@ -497,10 +499,9 @@ export default {
this.loading = true this.loading = true
this.queryParams.inboundOrderId = inboundOrderId this.queryParams.inboundOrderId = inboundOrderId
listInbound_itemsAndMname(this.queryParams).then(response => { listInbound_itemsAndMname(this.queryParams).then(response => {
console.log(response.rows)
this.displayData = response.rows.map(item => ({ this.displayData = response.rows.map(item => ({
...item, ...item,
sapNo: item.sapNo,
materialName: item.materialName, materialName: item.materialName,
editable: false, editable: false,
tempId: item.id || Date.now() + Math.random() tempId: item.id || Date.now() + Math.random()
...@@ -590,7 +591,8 @@ export default { ...@@ -590,7 +591,8 @@ export default {
const newItem = { const newItem = {
id: null, id: null,
orderId: this.orderId, orderId: this.orderId,
materialId: material.sapNo, materialId: material.id,
sapNo: material.sapNo,
materialName: material.materialName, materialName: material.materialName,
batchId: null, batchId: null,
warehouseId: null, warehouseId: null,
......
...@@ -11,14 +11,7 @@ import com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO; ...@@ -11,14 +11,7 @@ import com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO;
import com.ruoyi.inventory.domain.vo.InboundTemplateVO; import com.ruoyi.inventory.domain.vo.InboundTemplateVO;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
...@@ -129,12 +122,15 @@ public class InboundOrdersController extends BaseController ...@@ -129,12 +122,15 @@ public class InboundOrdersController extends BaseController
@PreAuthorize("@ss.hasPermi('inventory:inbound:import')") @PreAuthorize("@ss.hasPermi('inventory:inbound:import')")
@Log(title = "入库信息导入", businessType = BusinessType.IMPORT) @Log(title = "入库信息导入", businessType = BusinessType.IMPORT)
@PostMapping("/import") @PostMapping("/import")
public AjaxResult importTemplate(MultipartFile file , boolean updateSupport) throws Exception public AjaxResult importTemplate(@RequestParam("file") MultipartFile file,
// 接收 true/false
@RequestParam("updateSupport") Integer updateSupport,
@RequestParam(value = "orderType", required = false) Integer orderType) throws Exception
{ {
ExcelUtil<InboundTemplateVO> util = new ExcelUtil<InboundTemplateVO>(InboundTemplateVO.class); ExcelUtil<InboundTemplateVO> util = new ExcelUtil<InboundTemplateVO>(InboundTemplateVO.class);
List<InboundTemplateVO> inboundOrders = util.importExcel(file.getInputStream()); List<InboundTemplateVO> inboundOrders = util.importExcel(file.getInputStream());
String operName = getUsername(); String operName = getUsername();
String message = inboundOrdersService.importInboundOrders(inboundOrders, updateSupport, operName); String message = inboundOrdersService.importInboundOrders(inboundOrders, updateSupport, operName, orderType);
return success(message); return success(message);
} }
......
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.inventory.domain.Inventory; import com.ruoyi.inventory.domain.Inventory;
import com.ruoyi.inventory.domain.vo.InboundTemplateVO; import com.ruoyi.inventory.domain.vo.InboundTemplateVO;
import com.ruoyi.inventory.domain.vo.OutboundTemplateVO; import com.ruoyi.inventory.domain.vo.OutboundTemplateVO;
...@@ -123,7 +124,7 @@ public class OutboundOrdersController extends BaseController ...@@ -123,7 +124,7 @@ public class OutboundOrdersController extends BaseController
@PostMapping("/outboundOrdersTopTenByQuantity") @PostMapping("/outboundOrdersTopTenByQuantity")
public TableDataInfo outboundOrdersTopTenByQuantity(){ public TableDataInfo outboundOrdersTopTenByQuantity(){
List<Map<String,String>> resultMap = outboundOrdersService.outboundOrdersTopTenByQuantity(); List<Map<String,String>> resultMap = outboundOrdersService.outboundOrdersTopTenByQuantity();
return getDataTable( resultMap); return getDataTable(resultMap);
} }
@PreAuthorize("@ss.hasPermi('inventory:orders:query')") @PreAuthorize("@ss.hasPermi('inventory:orders:query')")
...@@ -136,7 +137,7 @@ public class OutboundOrdersController extends BaseController ...@@ -136,7 +137,7 @@ public class OutboundOrdersController extends BaseController
@PreAuthorize("@ss.hasPermi('inventory:orders:query')") @PreAuthorize("@ss.hasPermi('inventory:orders:query')")
@PostMapping("/outboundOrdersCount") @PostMapping("/outboundOrdersCount")
public AjaxResult outboundOrdersCount(){ public AjaxResult outboundOrdersCount(){
String resultMap = outboundOrdersService.outboundOrdersCount(); Object resultMap = outboundOrdersService.outboundOrdersCount();
return AjaxResult.success(resultMap); return AjaxResult.success(resultMap);
} }
/** /**
......
...@@ -41,6 +41,9 @@ public class InboundOrderItems extends BaseEntity ...@@ -41,6 +41,9 @@ public class InboundOrderItems extends BaseEntity
@Excel(name = "库位ID") @Excel(name = "库位ID")
private String locationId; private String locationId;
/** 收获库位 检索条件 */
private String receiptLocationId;
/** 计划数量 */ /** 计划数量 */
@Excel(name = "计划数量") @Excel(name = "计划数量")
private Long plannedQuantity; private Long plannedQuantity;
...@@ -85,6 +88,9 @@ public class InboundOrderItems extends BaseEntity ...@@ -85,6 +88,9 @@ public class InboundOrderItems extends BaseEntity
@Excel(name = "收货人") @Excel(name = "收货人")
private String receivedBy; private String receivedBy;
/** 贴标数量 */
private Long labelQuantity;
/** 应用数据1使用0删除 删除用 */ /** 应用数据1使用0删除 删除用 */
// @Excel(name = "应用数据") // @Excel(name = "应用数据")
private Long isUsed; private Long isUsed;
...@@ -319,6 +325,22 @@ public class InboundOrderItems extends BaseEntity ...@@ -319,6 +325,22 @@ public class InboundOrderItems extends BaseEntity
this.inboundOrderId = inboundOrderId; this.inboundOrderId = inboundOrderId;
} }
public String getReceiptLocationId() {
return receiptLocationId;
}
public void setReceiptLocationId(String receiptLocationId) {
this.receiptLocationId = receiptLocationId;
}
public Long getLabelQuantity() {
return labelQuantity;
}
public void setLabelQuantity(Long labelQuantity) {
this.labelQuantity = labelQuantity;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
...@@ -347,6 +369,8 @@ public class InboundOrderItems extends BaseEntity ...@@ -347,6 +369,8 @@ public class InboundOrderItems extends BaseEntity
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("updateUserCode", getUpdateUserCode()) .append("updateUserCode", getUpdateUserCode())
.append("inboundOrderId", getInboundOrderId()) .append("inboundOrderId", getInboundOrderId())
.append("receiptLocationId", getReceiptLocationId())
.append("labelQuantity", getLabelQuantity())
.toString(); .toString();
} }
} }
...@@ -27,9 +27,16 @@ public class InboundItemsAndMaterialName extends BaseEntity ...@@ -27,9 +27,16 @@ public class InboundItemsAndMaterialName extends BaseEntity
private String inboundOrderId; private String inboundOrderId;
/** 货物ID 字典,检索条件 */ /** 货物ID 字典,检索条件 */
@Excel(name = "货物ID") // @Excel(name = "货物ID")
private String materialId; private String materialId;
@Excel(name = "SapNo")
private String sapNo;
private String materialName;
private Double unitWeight;
/** 批次ID 检索条件 */ /** 批次ID 检索条件 */
@Excel(name = "批次ID") @Excel(name = "批次ID")
private String batchId; private String batchId;
...@@ -106,7 +113,7 @@ public class InboundItemsAndMaterialName extends BaseEntity ...@@ -106,7 +113,7 @@ public class InboundItemsAndMaterialName extends BaseEntity
// @Excel(name = "排序号") // @Excel(name = "排序号")
private String updateUserCode; private String updateUserCode;
private String materialName;
public void setId(String id) public void setId(String id)
{ {
...@@ -350,6 +357,22 @@ public class InboundItemsAndMaterialName extends BaseEntity ...@@ -350,6 +357,22 @@ public class InboundItemsAndMaterialName extends BaseEntity
this.locationName = locationName; this.locationName = locationName;
} }
public String getSapNo() {
return sapNo;
}
public void setSapNo(String sapNo) {
this.sapNo = sapNo;
}
public Double getUnitWeight() {
return unitWeight;
}
public void setUnitWeight(Double unitWeight) {
this.unitWeight = unitWeight;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
...@@ -381,6 +404,8 @@ public class InboundItemsAndMaterialName extends BaseEntity ...@@ -381,6 +404,8 @@ public class InboundItemsAndMaterialName extends BaseEntity
.append("inboundOrderId", getInboundOrderId()) .append("inboundOrderId", getInboundOrderId())
.append("warehousesName", getWarehousesName()) .append("warehousesName", getWarehousesName())
.append("locationName", getLocationName()) .append("locationName", getLocationName())
.append("sapNo", getSapNo())
.append("unitWeight", getUnitWeight())
.toString(); .toString();
} }
} }
...@@ -17,80 +17,70 @@ public class InboundTemplateVO extends BaseEntity { ...@@ -17,80 +17,70 @@ public class InboundTemplateVO extends BaseEntity {
/** 编号 */ /** 编号 */
private String id; private String id;
/** 入库单号 检索条件 */
@Excel(name = "入库单号")
private String orderId;
/** 系统编号 检索条件 */
@Excel(name = "系统编号")
private String systemNo;
/** 入库类型 字典,检索条件 */
@Excel(name = "入库类型")
private String orderTypeId;
/** 批次ID 检索条件 */
@Excel(name = "批次ID")
private String batchId;
/** 入库日期 日期无时间 */ /** 入库日期 日期无时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "入库日期", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "入库日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date inboundDate; private Date inboundDate;
/** 订单类型 字典,检索条件 */
@Excel(name = "订单类型")
private String orderType;
/** 备注 */
@Excel(name = "备注")
private String remark;
/** 货主ID */
@Excel(name = "货主ID")
private String ownerId;
/** 仓库ID 暂无用 */
@Excel(name = "仓库ID")
private String warehouseId;
/** 库位ID 检索条件 */
@Excel(name = "库位ID")
private String locationId;
/** 货物ID 字典,检索条件 */ /** 货物ID 字典,检索条件 */
@Excel(name = "SAP") @Excel(name = "SAP No")
private String sapNo; private String sapNo;
/** 货物ID 字典,检索条件 */ /** 货物名称 */
@Excel(name = "货物名称") @Excel(name = "物料名称")
private String materialName; private String materialName;
/** 负责人 暂无用 */ /** 货物名称 */
// @Excel(name = "负责人 暂无用") @Excel(name = "TS Code")
private String opUserName; private String tsCode;
/** 货主ID */
@Excel(name = "货主")
private String ownerId;
/** 批次ID 检索条件 */
@Excel(name = "批号")
private String batchId;
/** 计划数量 */ /** 计划数量 */
@Excel(name = "计划数量") @Excel(name = "计划数量")
private Long plannedQuantity; private Long plannedQuantity;
/** 实际数量 */ /** 入库单号 检索条件 */
@Excel(name = "实际数量") @Excel(name = "单号")
private Long actualQuantity; private String orderId;
/** 计划件数 暂无用 */ /** 系统编号 检索条件 */
// @Excel(name = "计划件数") @Excel(name = "系统编号")
private Long plannedPackages; private String systemNo;
/** 实际件数 */ /** 入库类型 字典,检索条件 */
@Excel(name = "实际件数") // @Excel(name = "入库类型")
private Long actualPackages; private String orderTypeId;
@Excel(name = "件重")
private Double unitWeight;
/** 约数 */ /** 约数 */
@Excel(name = "约数") @Excel(name = "约数")
private Long divisor; private Long divisor;
/** 实际件数 */
@Excel(name = "实际件数")
private Long actualPackages;
/** 实际数量 */
@Excel(name = "实发数量")
private Long actualQuantity;
/** 仓库ID 暂无用 */
@Excel(name = "仓库")
private String warehouseId;
/** 库位ID 检索条件 */
@Excel(name = "库位")
private String locationId;
/** 标签颜色 字典,检索条件 */ /** 标签颜色 字典,检索条件 */
@Excel(name = "标签颜色") @Excel(name = "标签颜色")
private Long labelColor; private Long labelColor;
...@@ -103,6 +93,14 @@ public class InboundTemplateVO extends BaseEntity { ...@@ -103,6 +93,14 @@ public class InboundTemplateVO extends BaseEntity {
@Excel(name = "单价") @Excel(name = "单价")
private Long unitPrice; private Long unitPrice;
/** 备注 */
@Excel(name = "备注")
private String remark;
/** 订单类型 字典,检索条件 */
@Excel(name = "订单类型")
private String orderType;
/** 收货人 */ /** 收货人 */
@Excel(name = "收货人") @Excel(name = "收货人")
private String receivedBy; private String receivedBy;
...@@ -111,6 +109,14 @@ public class InboundTemplateVO extends BaseEntity { ...@@ -111,6 +109,14 @@ public class InboundTemplateVO extends BaseEntity {
@Excel(name = "物料备注") @Excel(name = "物料备注")
private String remark2; private String remark2;
/** 负责人 暂无用 */
// @Excel(name = "负责人 暂无用")
private String opUserName;
/** 计划件数 暂无用 */
// @Excel(name = "件数")
private Long plannedPackages;
/** 排序号 */ /** 排序号 */
private Long sortNo; private Long sortNo;
...@@ -336,33 +342,54 @@ public class InboundTemplateVO extends BaseEntity { ...@@ -336,33 +342,54 @@ public class InboundTemplateVO extends BaseEntity {
this.sortNo = sortNo; this.sortNo = sortNo;
} }
public String getTsCode() {
return tsCode;
}
public void setTsCode(String tsCode) {
this.tsCode = tsCode;
}
public Double getUnitWeight() {
return unitWeight;
}
public void setUnitWeight(Double unitWeight) {
this.unitWeight = unitWeight;
}
@Override @Override
public String toString() { public String toString() {
return "InboundTemplateVO{" + return "InboundTemplateVO{" +
"id='" + id + '\'' + "id='" + id + '\'' +
", orderId='" + orderId + '\'' +
", systemNo='" + systemNo + '\'' +
", orderTypeId='" + orderTypeId + '\'' +
", batchId='" + batchId + '\'' +
", inboundDate=" + inboundDate + ", inboundDate=" + inboundDate +
", orderType='" + orderType + '\'' +
", remark1='" + remark + '\'' +
", ownerId='" + ownerId + '\'' +
", warehouseId='" + warehouseId + '\'' +
", locationId='" + locationId + '\'' +
", sapNo='" + sapNo + '\'' + ", sapNo='" + sapNo + '\'' +
", materialName='" + materialName + '\'' + ", materialName='" + materialName + '\'' +
", opUserName='" + opUserName + '\'' + ", tsCode='" + tsCode + '\'' +
", batchId='" + batchId + '\'' +
", plannedQuantity=" + plannedQuantity + ", plannedQuantity=" + plannedQuantity +
", actualQuantity=" + actualQuantity + ", orderId='" + orderId + '\'' +
", plannedPackages=" + plannedPackages + ", systemNo='" + systemNo + '\'' +
", actualPackages=" + actualPackages + ", orderTypeId='" + orderTypeId + '\'' +
", unitWeight=" + unitWeight +
", divisor=" + divisor + ", divisor=" + divisor +
", actualPackages=" + actualPackages +
", actualQuantity=" + actualQuantity +
", warehouseId='" + warehouseId + '\'' +
", locationId='" + locationId + '\'' +
", labelColor=" + labelColor + ", labelColor=" + labelColor +
", voucherNumber='" + voucherNumber + '\'' + ", voucherNumber='" + voucherNumber + '\'' +
", unitPrice=" + unitPrice + ", unitPrice=" + unitPrice +
", remark='" + remark + '\'' +
", orderType='" + orderType + '\'' +
", receivedBy='" + receivedBy + '\'' + ", receivedBy='" + receivedBy + '\'' +
", remark2='" + remark2 + '\'' + ", remark2='" + remark2 + '\'' +
", ownerId='" + ownerId + '\'' +
", opUserName='" + opUserName + '\'' +
", plannedPackages=" + plannedPackages +
", sortNo=" + sortNo +
", createUserCode='" + createUserCode + '\'' +
", updateUserCode='" + updateUserCode + '\'' +
'}'; '}';
} }
} }
...@@ -97,4 +97,11 @@ public interface MaterialsMapper ...@@ -97,4 +97,11 @@ public interface MaterialsMapper
* @return 结果 * @return 结果
*/ */
public int deleteMaterialsByIds(String[] ids); public int deleteMaterialsByIds(String[] ids);
/**
* 获取物料sap和id map字典
*
* @return 结果
*/
@MapKey("sap_no")
public Map<String,Map<String,String>> selectMaterialIdAndSapMap();
} }
...@@ -29,7 +29,15 @@ public interface IInboundOrderItemsService ...@@ -29,7 +29,15 @@ public interface IInboundOrderItemsService
* @return 入库单明细集合 * @return 入库单明细集合
*/ */
public List<InboundOrderItems> selectInboundOrderItemsList(InboundOrderItems inboundOrderItems); public List<InboundOrderItems> selectInboundOrderItemsList(InboundOrderItems inboundOrderItems);
/**
* 查询入库单明细列表
*
* @param inboundOrderItems 入库单明细
* @return 入库单明细集合
*/
public List<InboundOrderItems> selectInboundOrderItemsListAndMaterialName(InboundOrderItems inboundOrderItems); public List<InboundOrderItems> selectInboundOrderItemsListAndMaterialName(InboundOrderItems inboundOrderItems);
/** /**
* 新增入库单明细 * 新增入库单明细
* *
......
...@@ -69,7 +69,7 @@ public interface IInboundOrdersService ...@@ -69,7 +69,7 @@ public interface IInboundOrdersService
* @param inboundOrders,isUpdateSupport,operName 入库单数据信息 * @param inboundOrders,isUpdateSupport,operName 入库单数据信息
* @return 结果 * @return 结果
*/ */
public String importInboundOrders(List<InboundTemplateVO> inboundOrders, Boolean isUpdateSupport, String operName); public String importInboundOrders(List<InboundTemplateVO> inboundOrders, Integer isUpdateSupport, String operName, Integer orderType);
/** /**
......
...@@ -109,7 +109,7 @@ public class InboundOrderItemsServiceImpl implements IInboundOrderItemsService ...@@ -109,7 +109,7 @@ public class InboundOrderItemsServiceImpl implements IInboundOrderItemsService
} }
/** /**
* 导入入库单明细信息 * 导入入库单明细信息(暂无用)
* *
* @param inboundOrderItemsList,isUpdateSupport,operName 入库单数据信息 * @param inboundOrderItemsList,isUpdateSupport,operName 入库单数据信息
* @return 结果 * @return 结果
......
...@@ -6,6 +6,7 @@ import java.util.*; ...@@ -6,6 +6,7 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO; import com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO;
import com.ruoyi.inventory.mapper.MaterialsMapper;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
...@@ -35,6 +36,9 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService ...@@ -35,6 +36,9 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
{ {
@Autowired @Autowired
private InboundOrdersMapper inboundOrdersMapper; private InboundOrdersMapper inboundOrdersMapper;
@Autowired
private MaterialsMapper materialsMapper;
private static final Logger log = LoggerFactory.getLogger(InboundOrdersServiceImpl.class); private static final Logger log = LoggerFactory.getLogger(InboundOrdersServiceImpl.class);
/** /**
* 查询入库单主 * 查询入库单主
...@@ -155,7 +159,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService ...@@ -155,7 +159,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String importInboundOrders(List<InboundTemplateVO> inboundOrdersList, Boolean isUpdateSupport, String operName) { public String importInboundOrders(List<InboundTemplateVO> inboundOrdersList, Integer isUpdateSupport, String operName, Integer orderType) {
if (StringUtils.isNull(inboundOrdersList) || inboundOrdersList.size() == 0) { if (StringUtils.isNull(inboundOrdersList) || inboundOrdersList.size() == 0) {
throw new ServiceException("导入数据不能为空!"); throw new ServiceException("导入数据不能为空!");
} }
...@@ -174,7 +178,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService ...@@ -174,7 +178,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
Map<String, List<InboundTemplateVO>> orderGroupMap = inboundOrdersList.stream() Map<String, List<InboundTemplateVO>> orderGroupMap = inboundOrdersList.stream()
.filter(vo -> StringUtils.isNotBlank(vo.getOrderId())) // 过滤无入库单号的无效行 .filter(vo -> StringUtils.isNotBlank(vo.getOrderId())) // 过滤无入库单号的无效行
.collect(Collectors.groupingBy(InboundTemplateVO::getOrderId)); .collect(Collectors.groupingBy(InboundTemplateVO::getOrderId));
Map<String,Map<String,String>> sapAndIdMap = materialsMapper.selectMaterialIdAndSapMap();
// 4. 遍历每个入库单分组处理 // 4. 遍历每个入库单分组处理
for (Map.Entry<String, List<InboundTemplateVO>> entry : orderGroupMap.entrySet()) { for (Map.Entry<String, List<InboundTemplateVO>> entry : orderGroupMap.entrySet()) {
String orderId = entry.getKey(); String orderId = entry.getKey();
...@@ -188,7 +192,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService ...@@ -188,7 +192,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
// 检查入库单是否已存在 // 检查入库单是否已存在
InboundOrders existMain = inboundOrdersMapper.selectInboundOrdersByOrderId(orderId); InboundOrders existMain = inboundOrdersMapper.selectInboundOrdersByOrderId(orderId);
if (existMain != null) { if (existMain != null) {
if (!isUpdateSupport) { if (isUpdateSupport == 0) {
// 不支持更新,跳过该入库单 // 不支持更新,跳过该入库单
totalMainFailure++; totalMainFailure++;
failureMsg.append(String.format("入库单号【%s】已存在,且不支持更新,跳过导入;\n", orderId)); failureMsg.append(String.format("入库单号【%s】已存在,且不支持更新,跳过导入;\n", orderId));
...@@ -202,6 +206,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService ...@@ -202,6 +206,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
mainDO.setUpdateBy(operId); mainDO.setUpdateBy(operId);
mainDO.setUpdateTime(now); mainDO.setUpdateTime(now);
mainDO.setUpdateUserCode(operId); mainDO.setUpdateUserCode(operId);
mainDO.setOrderTypeId(orderType+"");
// 更新主表 // 更新主表
inboundOrdersMapper.updateInboundOrders(mainDO); inboundOrdersMapper.updateInboundOrders(mainDO);
totalMainSuccess++; totalMainSuccess++;
...@@ -222,6 +227,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService ...@@ -222,6 +227,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
mainDO.setUpdateBy(operId); mainDO.setUpdateBy(operId);
mainDO.setUpdateTime(now); mainDO.setUpdateTime(now);
mainDO.setUpdateUserCode(operId); mainDO.setUpdateUserCode(operId);
mainDO.setOrderTypeId(orderType+"");
// 设置默认值 // 设置默认值
if (mainDO.getSortNo() == null) { if (mainDO.getSortNo() == null) {
mainDO.setSortNo(0L); mainDO.setSortNo(0L);
...@@ -243,7 +249,8 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService ...@@ -243,7 +249,8 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
"orderId", "systemNo", "orderTypeId", "batchId"); // 排除主表字段 "orderId", "systemNo", "orderTypeId", "batchId"); // 排除主表字段
// 填充明细必填字段 // 填充明细必填字段
itemDO.setId(UUID.randomUUID().toString()); itemDO.setId(UUID.randomUUID().toString());
itemDO.setMaterialId(vo.getId()); Map<String,String> sapAndId = sapAndIdMap.get(vo.getSapNo());
itemDO.setMaterialId(sapAndId.get("id"));
itemDO.setOrderId(orderId); // 关联入库单号 itemDO.setOrderId(orderId); // 关联入库单号
itemDO.setBatchId(mainDO.getBatchId()); itemDO.setBatchId(mainDO.getBatchId());
itemDO.setInboundOrderId(mainDO.getId()); // 关联主表ID(核心!) itemDO.setInboundOrderId(mainDO.getId()); // 关联主表ID(核心!)
......
...@@ -91,6 +91,7 @@ public class InventoryServiceImpl implements IInventoryService ...@@ -91,6 +91,7 @@ public class InventoryServiceImpl implements IInventoryService
for (Inventory inventory : inventoryList) { for (Inventory inventory : inventoryList) {
inventory.setCreateTime(DateUtils.getNowDate()); inventory.setCreateTime(DateUtils.getNowDate());
inventory.setId(UUID.randomUUID().toString()); inventory.setId(UUID.randomUUID().toString());
inventory.setCreateUserCode(SystemUtils.getUserName());
count = inventoryMapper.insertInventory(inventory); count = inventoryMapper.insertInventory(inventory);
} }
return count; return count;
......
...@@ -71,6 +71,39 @@ ...@@ -71,6 +71,39 @@
</select> </select>
<resultMap type="com.ruoyi.inventory.domain.TO.InboundItemsAndMaterialName" id="InboundOrderItemsAndMnameResult">
<result property="id" column="id" />
<result property="orderId" column="order_id" />
<result property="materialId" column="material_id" />
<result property="sapNo" column="sap_no" />
<result property="materialName" column="material_name" />
<result property="unitWeight" column="unit_weight" />
<result property="batchId" column="batch_id" />
<result property="warehouseId" column="warehouse_id" />
<result property="warehousesName" column="warehouses_name" />
<result property="locationId" column="location_id" />
<result property="locationName" column="location_name" />
<result property="plannedQuantity" column="planned_quantity" />
<result property="actualQuantity" column="actual_quantity" />
<result property="plannedPackages" column="planned_packages" />
<result property="actualPackages" column="actual_packages" />
<result property="divisor" column="divisor" />
<result property="labelColor" column="label_color" />
<result property="voucherNumber" column="voucher_number" />
<result property="unitPrice" column="unit_price" />
<result property="itemStatus" column="item_status" />
<result property="receivedAt" column="received_at" />
<result property="receivedBy" column="received_by" />
<result property="remark" column="remark" />
<result property="isUsed" column="is_used" />
<result property="sortNo" column="sort_no" />
<result property="createTime" column="create_time" />
<result property="createUserCode" column="create_user_code" />
<result property="updateTime" column="update_time" />
<result property="updateUserCode" column="update_user_code" />
<result property="inboundOrderId" column="inbound_order_id" />
</resultMap>
<select id="selectInboundOrderItemsListAndMaterialName" <select id="selectInboundOrderItemsListAndMaterialName"
parameterType="com.ruoyi.inventory.domain.InboundOrderItems" parameterType="com.ruoyi.inventory.domain.InboundOrderItems"
...@@ -79,6 +112,9 @@ ...@@ -79,6 +112,9 @@
ii.id, ii.id,
ii.order_id, ii.order_id,
ii.material_id, ii.material_id,
m.material_name,
m.sap_no,
m.unit_weight,
ii.batch_id, ii.batch_id,
ii.warehouse_id, ii.warehouse_id,
w.warehouses_name, w.warehouses_name,
...@@ -277,36 +313,6 @@ ...@@ -277,36 +313,6 @@
</foreach> </foreach>
</delete> </delete>
<resultMap type="com.ruoyi.inventory.domain.TO.InboundItemsAndMaterialName" id="InboundOrderItemsAndMnameResult">
<result property="id" column="id" />
<result property="orderId" column="order_id" />
<result property="materialId" column="material_id" />
<result property="batchId" column="batch_id" />
<result property="warehouseId" column="warehouse_id" />
<result property="warehousesName" column="warehouses_name" />
<result property="locationId" column="location_id" />
<result property="locationName" column="location_name" />
<result property="plannedQuantity" column="planned_quantity" />
<result property="actualQuantity" column="actual_quantity" />
<result property="plannedPackages" column="planned_packages" />
<result property="actualPackages" column="actual_packages" />
<result property="divisor" column="divisor" />
<result property="labelColor" column="label_color" />
<result property="voucherNumber" column="voucher_number" />
<result property="unitPrice" column="unit_price" />
<result property="itemStatus" column="item_status" />
<result property="receivedAt" column="received_at" />
<result property="receivedBy" column="received_by" />
<result property="remark" column="remark" />
<result property="isUsed" column="is_used" />
<result property="sortNo" column="sort_no" />
<result property="createTime" column="create_time" />
<result property="createUserCode" column="create_user_code" />
<result property="updateTime" column="update_time" />
<result property="updateUserCode" column="update_user_code" />
<result property="inboundOrderId" column="inbound_order_id" />
<result property="materialName" column="material_name" />
</resultMap>
<resultMap id="InboundDetailsResultMap" type="com.ruoyi.inventory.domain.vo.InboundDetailsVO"> <resultMap id="InboundDetailsResultMap" type="com.ruoyi.inventory.domain.vo.InboundDetailsVO">
<!-- 基础字段映射 --> <!-- 基础字段映射 -->
......
...@@ -36,7 +36,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -36,7 +36,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="com.ruoyi.inventory.domain.TO.InboundItemsAndMaterialName" id="InboundOrderItemsResult"> <resultMap type="com.ruoyi.inventory.domain.TO.InboundItemsAndMaterialName" id="InboundOrderItemsResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="orderId" column="order_id" /> <result property="orderId" column="order_id" />
<result property="materialId" column="material_id" /> <result property="materialId" column="material_id"/>
<result property="sapNo" column="sap_no" />
<result property="materialName" column="material_name" /> <result property="materialName" column="material_name" />
<result property="batchId" column="batch_id" /> <result property="batchId" column="batch_id" />
<result property="warehouseId" column="warehouse_id" /> <result property="warehouseId" column="warehouse_id" />
...@@ -104,7 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -104,7 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectInboundOrderItemsList" resultMap="InboundOrderItemsResult"> <select id="selectInboundOrderItemsList" resultMap="InboundOrderItemsResult">
select ioi.id, ioi.order_id, ioi.material_id, m.material_name, ioi.batch_id, ioi.warehouse_id, w.warehouses_name, select ioi.id, ioi.order_id, ioi.material_id, m.sap_no, m.material_name, ioi.batch_id, ioi.warehouse_id, w.warehouses_name,
ioi.location_id, sl.location_name, ioi.planned_quantity, ioi.actual_quantity, ioi.planned_packages, ioi.location_id, sl.location_name, ioi.planned_quantity, ioi.actual_quantity, ioi.planned_packages,
ioi.actual_packages, ioi.divisor, ioi.label_color, ioi.voucher_number, ioi.unit_price, ioi.item_status, ioi.actual_packages, ioi.divisor, ioi.label_color, ioi.voucher_number, ioi.unit_price, ioi.item_status,
ioi.received_at, ioi.received_by, ioi.remark, ioi.is_used, ioi.sort_no, ioi.create_time, ioi.create_user_code, ioi.received_at, ioi.received_by, ioi.remark, ioi.is_used, ioi.sort_no, ioi.create_time, ioi.create_user_code,
...@@ -229,6 +230,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -229,6 +230,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</insert> </insert>
<!-- 统计入库次数--> <!-- 统计入库次数-->
<select id="countInboundOrders" resultType="int" parameterType="String"> <select id="countInboundOrders" resultType="int" parameterType="String">
select count(id) select count(id)
...@@ -236,7 +239,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -236,7 +239,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where DATE_FORMAT(inbound_date, '%Y-%m') = #{monthParam}; where DATE_FORMAT(inbound_date, '%Y-%m') = #{monthParam};
</select> </select>
<!-- 统计入库物料数量Top10--> <!-- 统计入库物料数量Top10-->
<resultMap id="InboundMaterialTotalResultMap" type="com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO"> <resultMap id="InboundMaterialTotalResultMap" type="com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO">
<result column="material_name" property="materialName" jdbcType="VARCHAR"/> <result column="material_name" property="materialName" jdbcType="VARCHAR"/>
...@@ -250,7 +252,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -250,7 +252,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
inner join materials as m on ioi.material_id = m.id inner join materials as m on ioi.material_id = m.id
where io.order_status = 2 where io.order_status = 2
group by m.id group by m.id
order by total_quantity desc order by total_quantity asc
</select> </select>
<select id="countInboundMaterialMoney" resultMap="InboundMaterialTotalResultMap" parameterType="String"> <select id="countInboundMaterialMoney" resultMap="InboundMaterialTotalResultMap" parameterType="String">
select m.material_name,sum(ioi.actual_quantity * ioi.unit_price) as total_money select m.material_name,sum(ioi.actual_quantity * ioi.unit_price) as total_money
...@@ -259,6 +261,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -259,6 +261,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
inner join materials as m on ioi.material_id = m.id inner join materials as m on ioi.material_id = m.id
where io.order_status = 2 where io.order_status = 2
group by m.id group by m.id
order by total_money desc order by total_money asc
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -33,6 +33,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -33,6 +33,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="updateUserCode" column="update_user_code" /> <result property="updateUserCode" column="update_user_code" />
<result property="warehousesId" column="warehouses_id" /> <result property="warehousesId" column="warehouses_id" />
<result property="materialName" column="material_name" />
<result property="minStockLevel" column="min_stock_level" jdbcType="BIGINT"/>
<result property="maxStockLevel" column="max_stock_level" jdbcType="BIGINT"/>
<result property="sapNo" column="sap_no" />
<result property="tsCode" column="ts_code" />
<result property="hazardId" column="hazard_id" />
<result property="specification" column="specification" />
<result property="materialUnit" column="material_unit" />
<result property="unitWeight" column="unit_weight" />
<result property="packageWeight" column="package_weight" />
<result property="totalWeight" column="total_weight" />
<result property="volume" column="volume" />
<result property="shelfLifeDays" column="shelf_life_days" />
<result property="storageTemperature" column="storage_temperature" />
<result property="specialRequirements" column="special_requirements" />
<result property="alterType" column="alterType" />
<result property="warehousesName" column="warehouses_name" />
<result property="locationName" column="location_name" />
<result property="ownerName" column="owner_name" />
</resultMap> </resultMap>
<resultMap type="com.ruoyi.inventory.domain.TO.StocktakeItemsTo" id="StocktakeItemsResult"> <resultMap type="com.ruoyi.inventory.domain.TO.StocktakeItemsTo" id="StocktakeItemsResult">
......
...@@ -206,4 +206,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -206,4 +206,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<!-- <resultMap id="SapAndIdMap" type="java.util.Map">-->
<!-- <result column="sap_no" property="key"/>-->
<!-- <result column="id" property="value"/>-->
<!-- </resultMap>-->
<select id="selectMaterialIdAndSapMap" resultType="java.util.Map">
select id,sap_no from materials where is_used = 1
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -129,6 +129,7 @@ ...@@ -129,6 +129,7 @@
oo.order_type, -- 新增order_type字段查询 oo.order_type, -- 新增order_type字段查询
oo.batch_code, oo.batch_code,
oo.warehouse_id, oo.warehouse_id,
w.warehouses_name as warehouse_name,
oo.owner_id, oo.owner_id,
o.owner_name, o.owner_name,
oo.order_status, oo.order_status,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论