From d56d5faa963fcbc8458ee164eaafde467a5e504d Mon Sep 17 00:00:00 2001
From: liuying <1427574514@qq.com>
Date: 周二, 23 4月 2024 17:39:15 +0800
Subject: [PATCH] 替代品
---
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsSubstituteGood/editForm.vue | 123 +++
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsSubstituteGood/addForm.vue | 103 +++
iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/Dto/WmsSubstituteGoodInput.cs | 215 ++++++
iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/Map/WmsSubstituteGoodMapper.cs | 18
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsSubstituteGood/excelForm.vue | 181 +++++
iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/Dto/WmsSubstituteGoodOutput.cs | 72 ++
iWare_RawMaterialWarehouse_Wms/Admin.NET.Web.Entry/wwwroot/ExcelTemplateFile/WmsSubstituteGoodImport.xlsx | 0
iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/IWmsSubstituteGoodService.cs | 22
iWare_RawMaterialWarehouse_Web/src/api/modular/main/WmsBase/WmsSubstituteGoodManage.js | 114 +++
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsSubstituteGood/index.vue | 537 ++++++++++++++++
iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/WmsSubstituteGoodService.cs | 481 +++++++++++++++
11 files changed, 1,866 insertions(+), 0 deletions(-)
diff --git a/iWare_RawMaterialWarehouse_Web/src/api/modular/main/WmsBase/WmsSubstituteGoodManage.js b/iWare_RawMaterialWarehouse_Web/src/api/modular/main/WmsBase/WmsSubstituteGoodManage.js
new file mode 100644
index 0000000..ece8311
--- /dev/null
+++ b/iWare_RawMaterialWarehouse_Web/src/api/modular/main/WmsBase/WmsSubstituteGoodManage.js
@@ -0,0 +1,114 @@
+锘縤mport { axios } from '@/utils/request'
+
+/**
+ * 鏌ヨ鏇夸唬鍝佺鐞�
+ *
+ * @author ly
+ */
+export function WmsSubstituteGoodPage (parameter) {
+ return axios({
+ url: '/WmsSubstituteGood/page',
+ method: 'get',
+ params: parameter
+ })
+}
+
+/**
+ * 鏇夸唬鍝佺鐞嗗垪琛�
+ *
+ * @author ly
+ */
+export function WmsSubstituteGoodList (parameter) {
+ return axios({
+ url: '/WmsSubstituteGood/list',
+ method: 'get',
+ params: parameter
+ })
+}
+
+/**
+ * 娣诲姞鏇夸唬鍝佺鐞�
+ *
+ * @author ly
+ */
+export function WmsSubstituteGoodAdd (parameter) {
+ return axios({
+ url: '/WmsSubstituteGood/add',
+ method: 'post',
+ data: parameter
+ })
+}
+
+/**
+ * 缂栬緫鏇夸唬鍝佺鐞�
+ *
+ * @author ly
+ */
+export function WmsSubstituteGoodEdit (parameter) {
+ return axios({
+ url: '/WmsSubstituteGood/edit',
+ method: 'post',
+ data: parameter
+ })
+}
+
+/**
+ * 鍒犻櫎鏇夸唬鍝佺鐞�
+ *
+ * @author ly
+ */
+export function WmsSubstituteGoodDelete (parameter) {
+ return axios({
+ url: '/WmsSubstituteGood/delete',
+ method: 'post',
+ data: parameter
+ })
+}
+
+
+/**
+ * 瀵煎嚭鏇夸唬鍝佺鐞嗙殑Excel鏂囦欢
+ *
+ * @author ly
+ */
+export function WmsSubstituteGoodToExcel (parameter) {
+ return axios({
+ url: '/WmsSubstituteGood/toExcel',
+ method: 'get',
+ params: parameter,
+ responseType: 'blob'
+ })
+}
+
+/**
+ * 瀵煎叆鏇夸唬鍝佺鐞嗙殑Excel鏂囦欢
+ *
+ * @author ly
+ */
+export function WmsSubstituteGoodImportExcel (data, parameter) {
+ return axios({
+ url: '/WmsSubstituteGood/importExcel',
+ method: 'post',
+ data: data,
+ params: parameter
+
+ })
+}
+
+
+/**
+ * 涓嬭浇鏇夸唬鍝佺鐞嗙殑Excel瀵煎叆妯℃澘
+ *
+ * @author ly
+ */
+export function WmsSubstituteGoodDownloadExcelTemplate(parameter) {
+ return axios({
+ url: '/WmsSubstituteGood/downloadExcelTemplate',
+ method: 'get',
+ params: parameter,
+ responseType: 'blob'
+ })
+}
+
+
+
diff --git a/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsSubstituteGood/addForm.vue b/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsSubstituteGood/addForm.vue
new file mode 100644
index 0000000..23359a0
--- /dev/null
+++ b/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsSubstituteGood/addForm.vue
@@ -0,0 +1,103 @@
+锘�<template>
+ <a-modal
+ title="鏂板鏇夸唬鍝佺鐞�"
+ :width="900"
+ :visible="visible"
+ :confirmLoading="confirmLoading"
+ @ok="handleSubmit"
+ @cancel="handleCancel">
+ <a-spin :spinning="confirmLoading">
+ <a-form :form="form">
+ <a-form-item label="鏇夸唬缂栧彿" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
+ <a-input placeholder="璇疯緭鍏ユ浛浠g紪鍙�" v-decorator="['substituteCode', {rules: [{required: true, message: '璇疯緭鍏ユ浛浠g紪鍙凤紒'}]}]" />
+ </a-form-item>
+ <a-form-item label="鐗╂枡缂栧彿" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
+ <a-input placeholder="璇疯緭鍏ョ墿鏂欑紪鍙�" v-decorator="['materialCode', {rules: [{required: true, message: '璇疯緭鍏ョ墿鏂欑紪鍙凤紒'}]}]" />
+ </a-form-item>
+ <a-form-item label="鐗╂枡鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
+ <a-input placeholder="璇疯緭鍏ョ墿鏂欏悕绉�" v-decorator="['materialName', {rules: [{required: true, message: '璇疯緭鍏ョ墿鏂欏悕绉帮紒'}]}]" />
+ </a-form-item>
+ <a-form-item label="鏇夸唬鍝佺墿鏂欑紪鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
+ <a-input placeholder="璇疯緭鍏ユ浛浠e搧鐗╂枡缂栧彿" v-decorator="['substituteMaterialCode', {rules: [{required: true, message: '璇疯緭鍏ユ浛浠e搧鐗╂枡缂栧彿锛�'}]}]" />
+ </a-form-item>
+ <a-form-item label="鏇夸唬鍝佺墿鏂欏悕绉�" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
+ <a-input placeholder="璇疯緭鍏ユ浛浠e搧鐗╂枡鍚嶇О" v-decorator="['substituteMaterialName', {rules: [{required: true, message: '璇疯緭鍏ユ浛浠e搧鐗╂枡鍚嶇О锛�'}]}]" />
+ </a-form-item>
+ <a-form-item label="鏇夸唬娆″簭" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
+ <a-input-number placeholder="璇疯緭鍏ユ浛浠f搴�" style="width: 100%" v-decorator="['substituteIndex', {rules: [{required: true, message: '璇疯緭鍏ユ浛浠f搴忥紒'}]}]" />
+ </a-form-item>
+ <a-form-item label="鏄惁绂佺敤" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
+ <a-switch v-decorator="['isDisabled',{rules: [{ required: true, message: '璇烽�夋嫨鏄惁绂佺敤锛�' }], valuePropName: 'checked'}]" />
+ </a-form-item>
+ </a-form>
+ </a-spin>
+ </a-modal>
+</template>
+
+<script>
+ import moment from 'moment'
+ import {
+ WmsSubstituteGoodAdd
+ } from '@/api/modular/main/WmsBase/WmsSubstituteGoodManage'
+ export default {
+ data () {
+ return {
+ labelCol: {
+ xs: { span: 24 },
+ sm: { span: 5 }
+ },
+ wrapperCol: {
+ xs: { span: 24 },
+ sm: { span: 15 }
+ },
+ visible: false,
+ confirmLoading: false,
+ form: this.$form.createForm(this)
+ }
+ },
+ methods: {
+ moment,
+ // 鍒濆鍖栨柟娉�
+ add (record) {
+ this.visible = true
+ this.$nextTick(() => {
+
+ });
+ },
+ /**
+ * 鎻愪氦琛ㄥ崟
+ */
+ handleSubmit () {
+ const { form: { validateFields } } = this
+ this.confirmLoading = true
+ validateFields((errors, values) => {
+ if (!errors) {
+ for (const key in values) {
+ if (typeof (values[key]) === 'object') {
+ values[key] = JSON.stringify(values[key])
+ }
+ }
+ WmsSubstituteGoodAdd(values).then((res) => {
+ if (res.success) {
+ this.$message.success('鏂板鎴愬姛')
+ this.confirmLoading = false
+ this.$emit('ok', values)
+ this.handleCancel()
+ } else {
+ this.$message.error('鏂板澶辫触锛�' + JSON.stringify(res.message))
+ }
+ }).finally((res) => {
+ this.confirmLoading = false
+ })
+ } else {
+ this.confirmLoading = false
+ }
+ })
+ },
+ handleCancel () {
+ this.form.resetFields()
+ this.visible = false
+ }
+ }
+ }
+</script>
diff --git a/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsSubstituteGood/editForm.vue b/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsSubstituteGood/editForm.vue
new file mode 100644
index 0000000..c755d17
--- /dev/null
+++ b/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsSubstituteGood/editForm.vue
@@ -0,0 +1,123 @@
+锘�<template>
+ <a-modal
+ title="缂栬緫鏇夸唬鍝佺鐞�"
+ :width="900"
+ :visible="visible"
+ :confirmLoading="confirmLoading"
+ @ok="handleSubmit"
+ @cancel="handleCancel">
+ <a-spin :spinning="confirmLoading">
+ <a-form :form="form">
+ <a-form-item label="鏇夸唬缂栧彿" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
+ <a-input placeholder="璇疯緭鍏ユ浛浠g紪鍙�" v-decorator="['substituteCode', {rules: [{required: true, message: '璇疯緭鍏ユ浛浠g紪鍙凤紒'}]}]" />
+ </a-form-item>
+ <a-form-item label="鐗╂枡缂栧彿" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
+ <a-input placeholder="璇疯緭鍏ョ墿鏂欑紪鍙�" v-decorator="['materialCode', {rules: [{required: true, message: '璇疯緭鍏ョ墿鏂欑紪鍙凤紒'}]}]" />
+ </a-form-item>
+ <a-form-item label="鐗╂枡鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
+ <a-input placeholder="璇疯緭鍏ョ墿鏂欏悕绉�" v-decorator="['materialName', {rules: [{required: true, message: '璇疯緭鍏ョ墿鏂欏悕绉帮紒'}]}]" />
+ </a-form-item>
+ <a-form-item label="鏇夸唬鍝佺墿鏂欑紪鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
+ <a-input placeholder="璇疯緭鍏ユ浛浠e搧鐗╂枡缂栧彿" v-decorator="['substituteMaterialCode', {rules: [{required: true, message: '璇疯緭鍏ユ浛浠e搧鐗╂枡缂栧彿锛�'}]}]" />
+ </a-form-item>
+ <a-form-item label="鏇夸唬鍝佺墿鏂欏悕绉�" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
+ <a-input placeholder="璇疯緭鍏ユ浛浠e搧鐗╂枡鍚嶇О" v-decorator="['substituteMaterialName', {rules: [{required: true, message: '璇疯緭鍏ユ浛浠e搧鐗╂枡鍚嶇О锛�'}]}]" />
+ </a-form-item>
+ <a-form-item label="鏇夸唬娆″簭" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
+ <a-input-number placeholder="璇疯緭鍏ユ浛浠f搴�" style="width: 100%" v-decorator="['substituteIndex', {rules: [{required: true, message: '璇疯緭鍏ユ浛浠f搴忥紒'}]}]" />
+ </a-form-item>
+ <a-form-item label="鏄惁绂佺敤" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
+ <a-switch v-decorator="['isDisabled',{rules: [{ required: true, message: '璇烽�夋嫨鏄惁绂佺敤锛�' }], valuePropName: 'checked'}]" />
+ </a-form-item>
+ <a-form-item v-show="false"><a-input v-decorator="['id']" /></a-form-item>
+ </a-form>
+ </a-spin>
+ </a-modal>
+</template>
+
+<script>
+import moment from 'moment'
+ import {
+ WmsSubstituteGoodEdit
+ } from '@/api/modular/main/WmsBase/WmsSubstituteGoodManage'
+ export default {
+ data () {
+ return {
+ Id: 0,
+ labelCol: {
+ xs: { span: 24 },
+ sm: { span: 5 }
+ },
+ wrapperCol: {
+ xs: { span: 24 },
+ sm: { span: 15 }
+ },
+ record: {},
+ visible: false,
+ confirmLoading: false,
+ form: this.$form.createForm(this)
+ }
+ },
+ methods: {
+ moment,
+ // 鍒濆鍖栨柟娉�
+ edit (record) {
+ this.visible = true;
+ this.Id = record.id;
+ this.$nextTick(() => {
+ });
+ //娣卞害鎷疯礉 绉婚櫎VUE鐨勭洃鍚紝闃叉INDEX椤甸潰鍊煎彉鍔�
+ this.record = JSON.parse(JSON.stringify(record))
+ this.$nextTick(() => {
+ this.form.setFieldsValue(
+ {
+ id: record.id,
+ substituteCode: record.substituteCode,
+ materialCode: record.materialCode,
+ materialName: record.materialName,
+ substituteMaterialCode: record.substituteMaterialCode,
+ substituteMaterialName: record.substituteMaterialName,
+ substituteIndex: record.substituteIndex,
+ isDisabled: record.isDisabled
+ }
+ )
+ })
+ },
+ handleSubmit () {
+ const { form: { validateFields } } = this
+ this.confirmLoading = true
+ validateFields((errors, values) => {
+ if (!errors) {
+ for (const key in values) {
+ if (values[key] == null) continue
+ if (typeof (values[key]) === 'object') {
+ values[key] = JSON.stringify(values[key])
+ this.record[key] = values[key]
+ } else {
+ this.record[key] = values[key]
+ }
+ }
+ WmsSubstituteGoodEdit(this.record).then((res) => {
+ if (res.success) {
+ this.$message.success('缂栬緫鎴愬姛')
+ this.confirmLoading = false
+ this.$emit('ok', this.record)
+ this.handleCancel()
+ } else {
+ this.$message.error('缂栬緫澶辫触锛�' + JSON.stringify(res.message))
+ }
+ }).finally((res) => {
+ this.confirmLoading = false
+ })
+ }else{
+ this.confirmLoading = false
+ }
+ });
+ },
+ handleCancel () {
+ this.form.resetFields()
+ this.visible = false
+ }
+ }
+ }
+</script>
diff --git a/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsSubstituteGood/excelForm.vue b/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsSubstituteGood/excelForm.vue
new file mode 100644
index 0000000..4c8af3c
--- /dev/null
+++ b/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsSubstituteGood/excelForm.vue
@@ -0,0 +1,181 @@
+锘�<template>
+ <a-modal
+ :width="850"
+ :destroyOnClose="true"
+ :visible="visible"
+ :forceRender="true"
+ title="鎵归噺瀵煎叆"
+ cancelText="鍙栨秷涓婁紶"
+ okText="寮�濮嬩笂浼�"
+ @cancel="handleCancel"
+ @ok="handleSubmit">
+ <a-spin :spinning="confirmLoading">
+ <a-row :span="24">
+ <span>璇烽�夋嫨瑕佸鍏ョ殑鏁版嵁鏂囦欢锛圗xcel鏍煎紡锛�</span>
+ </a-row>
+ <p></p>
+ <a-row>
+ <a-col :span="16">
+ <a-upload-dragger accept=".xlsx,.xls" :multiple="false" :customRequest="customRequest" @change="handleChange" :beforeUpload="beforeUpload">
+ <a-icon style="font-size: 40px;" type="cloud-upload" />
+ </a-upload-dragger>
+ </a-col>
+ <!--<a-col :span="8">
+ <span>瀵煎叆妯″紡锛�</span>
+ <a-select
+ style="width: 130px"
+ placeholder="璇烽�夋嫨瀵煎叆妯″紡"
+ v-model="importExcelType">
+ <a-select-option
+ v-for="(item,index) in importExcelTypeData"
+ :key="index"
+ :value="item.code">{{ item.name }}
+ </a-select-option>
+ </a-select>
+ </a-col>-->
+ </a-row>
+ <a-row :span="24">
+ <!--<a-button @click="showDemand" style="width: 150px;text-align: left;" type="link" v-show="!detailed">
+ 鐐瑰嚮鏌ョ湅鏂囦欢涓婁紶瑕佹眰
+ </a-button>-->
+ <span>銆�</span>
+ <a-button style="width: 90px;text-align: left;" @click="wmsSubstituteGoodDownloadExcelTemplate" type="link">涓嬭浇瀵煎叆妯℃澘</a-button>锛屽~鍐欏苟涓婁紶
+ <span>銆�</span>
+ <a-button @click="showDemand" style="width: 150px;text-align: left;" type="link" v-show="detailed">
+ 鏀惰捣
+ </a-button>
+ </a-row>
+ <a-row v-show="detailed" style="background: #fef4e8; height: 30px;" :span="24">
+ <a-breadcrumb>
+ <a-breadcrumb-item style="line-height: 30px;color: #faad14;margin-left: 18px;">鏂囦欢涓婁紶瑕佹眰</a-breadcrumb-item>
+ </a-breadcrumb>
+ </a-row>
+ <pre v-show="detailed">
+ <div v-html="demandText"></div>
+ </pre>
+ <a-table v-show="detailed" :columns="columns" :data-source="dataList" :rowKey="(record) => record.processID" :pagination="false"></a-table>
+ <pre v-show="detailed">
+ <div v-html="columnText"></div>
+ </pre>
+ </a-spin>
+ </a-modal>
+</template>
+
+<script>
+ import { downloadFile, checkFile, parseExcelFieldText, parseDemandText } from '@/utils/util'
+
+ import { WmsSubstituteGoodImportExcel, WmsSubstituteGoodDownloadExcelTemplate} from '@/api/modular/main/WmsBase/WmsSubstituteGoodManage'
+ import { sysExcelTemplateGetColumnList } from '@/api/modular/system/excelTemplateManage'
+ export default {
+ components: {
+ },
+ data() {
+ return {
+ visible: false,
+ detailed: false,
+ confirmLoading: false,
+ fileList: [],
+ importExcelTypeData: [],
+ importExcelType: '1',
+ uploadFile: null,
+ columns: [],
+ dataList: [],
+ demandText:'',
+ columnText: ''
+ }
+ },
+ methods: {
+ index() {
+ this.visible = true;
+ this.importExcelTypeData = this.$options.filters['dictData']('import_excel_type')
+ this.demandText = parseDemandText("wmsSubstituteGoodDownloadExcelTemplate")
+ window.downloadFile = this.wmsSubstituteGoodDownloadExcelTemplate;
+ this.getTable();
+ },
+ showDemand() {
+ this.detailed = !this.detailed;
+ },
+ customRequest(document) {
+ this.uploadFile = document
+ },
+ getTable() {
+ sysExcelTemplateGetColumnList({className: "WmsSubstituteGood"}).then(res =>
+ {
+ if (res.success) {
+ this.columns =[];
+ this.dataList = [{}];
+ res.data.forEach(x => {
+ this.columns.push({
+ dataIndex: x.columnName,
+ key: x.columnName,
+ title: x.columnComment
+ });
+ this.dataList[0][x.columnName] = x.isRequired ? "蹇呭~" : "闈炲繀濉�"
+ });
+ this.columnText = parseExcelFieldText(res.data);
+ }
+ });
+ },
+ beforeUpload(fileInfo) {
+ let res = checkFile(fileInfo, 1073741824, ['.xlsx', '.xls']);
+ if (!res.success) {
+ this.$message.warning(res.msg)
+ return false
+ }
+ setTimeout(() => {this.uploadFile.onSuccess(this.uploadFile.file)}, 1000)
+ },
+ handleChange(fileInfo) {
+ if (fileInfo.file.status === 'error') {
+ fileInfo.fileList.splice(0, 1)
+ }
+ if (fileInfo.file.status === 'done') {
+ if (fileInfo.fileList.length > 1) {
+ fileInfo.fileList.splice(0, 1)
+ }
+ this.fileList = fileInfo.file
+ }
+ },
+ handleSubmit() {
+ this.confirmLoading = true
+ const formData = new FormData()
+ formData.append('file', this.uploadFile.file)
+ WmsSubstituteGoodImportExcel(formData, {importExcelType: this.importExcelType}).then(res => {
+ this.$message.success('鎿嶄綔鎴愬姛')
+ this.confirmLoading = false
+ this.$emit('ok', [])
+ this.handleCancel()
+ }).finally((res)=>{this.confirmLoading = false})
+ },
+ handleCancel() {
+ this.visible = false
+ this.detailed = false
+ },
+ wmsSubstituteGoodDownloadExcelTemplate() {
+ WmsSubstituteGoodDownloadExcelTemplate({version: "v2"}).then((res) => {
+ downloadFile(res);
+ }).catch((err) => {
+ this.$message.error('涓嬭浇閿欒锛氳幏鍙栨枃浠舵祦閿欒' + err)
+ })
+ }
+ }
+ }
+</script>
+
+<style scoped>
+::v-deep .ant-upload.ant-upload-drag {
+ position: relative;
+ width: 140px;
+ height: 135px;
+ text-align: center;
+ background: #fafafa;
+ border: 1px dashed #d9d9d9;
+ border-radius: 2px;
+ cursor: pointer;
+ -webkit-transition: border-color 0.3s;
+ transition: border-color 0.3s;
+}
+::v-deep .ant-btn:focus:not(.ant-btn-primary):not(.ant-btn-danger), .ant-btn:hover:not(.ant-btn-primary):not(.ant-btn-danger) {
+ color: #ffc53d;
+ border-color: white;
+}
+</style>
\ No newline at end of file
diff --git a/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsSubstituteGood/index.vue b/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsSubstituteGood/index.vue
new file mode 100644
index 0000000..8e04a41
--- /dev/null
+++ b/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsSubstituteGood/index.vue
@@ -0,0 +1,537 @@
+锘�<template>
+ <div ref="boxOutWrap" class="boxOutWrap">
+ <div ref="boxForm" class="boxForm">
+ <a-card :bordered="false" :bodyStyle="tstyle">
+
+ <div class="table-page-search-wrapper" v-if="hasPerm('WmsSubstituteGood:page')">
+ <a-form layout="inline">
+ <a-row :gutter="48">
+ <a-col :md="8" :sm="24">
+ <a-form-item label="鏇夸唬缂栧彿">
+ <a-input v-model="queryParam.substituteCode" allow-clear placeholder="璇疯緭鍏ユ浛浠g紪鍙�"/>
+ </a-form-item>
+ </a-col>
+ <a-col :md="8" :sm="24">
+ <a-form-item label="鐗╂枡缂栧彿">
+ <a-input v-model="queryParam.materialCode" allow-clear placeholder="璇疯緭鍏ョ墿鏂欑紪鍙�"/>
+ </a-form-item>
+ </a-col><template v-if="advanced">
+ <a-col :md="8" :sm="24">
+ <a-form-item label="鐗╂枡鍚嶇О">
+ <a-input v-model="queryParam.materialName" allow-clear placeholder="璇疯緭鍏ョ墿鏂欏悕绉�"/>
+ </a-form-item>
+ </a-col>
+ <a-col :md="8" :sm="24">
+ <a-form-item label="鏇夸唬鍝佺墿鏂欑紪鍙�">
+ <a-input v-model="queryParam.substituteMaterialCode" allow-clear placeholder="璇疯緭鍏ユ浛浠e搧鐗╂枡缂栧彿"/>
+ </a-form-item>
+ </a-col>
+ <a-col :md="8" :sm="24">
+ <a-form-item label="鏇夸唬鍝佺墿鏂欏悕绉�">
+ <a-input v-model="queryParam.substituteMaterialName" allow-clear placeholder="璇疯緭鍏ユ浛浠e搧鐗╂枡鍚嶇О"/>
+ </a-form-item>
+ </a-col><a-col :md="8" :sm="24">
+ <a-form-item label="鏇夸唬娆″簭">
+ <a-input-number v-model="queryParam.substituteIndex" style="width: 100%" allow-clear placeholder="璇疯緭鍏ユ浛浠f搴�"/>
+ </a-form-item>
+ </a-col>
+ <a-col :md="8" :sm="24">
+ <a-form-item label="鏄惁绂佺敤">
+ <a-select :allowClear="true" style="width: 100%" v-model="queryParam.isDisabled" placeholder="璇烽�夋嫨鏄惁绂佺敤">
+ <a-select-option v-for="(item,index) in isDisabledData" :key="index" :value="item.code">{{ item.name }}</a-select-option>
+ </a-select>
+ </a-form-item>
+ </a-col>
+ <!--骞存湀鏃ユ椂鍒嗙-->
+ <!--鏃堕棿鑼冨洿-->
+
+ <a-col :md="8" :sm="24">
+ <a-form-item label="鍒涘缓鏃堕棿">
+ <a-range-picker style="width: 100%" :placeholder="['寮�濮嬫椂闂�', '缁撴潫鏃堕棿']" :show-time="{
+format: 'HH:mm:ss', defaultValue: [moment('00:00:00', 'HH:mm:ss'),moment('23:59:59', 'HH:mm:ss')]}" v-model="queryParam.createdTime" value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" @change="onChangecreatedTime"/>
+
+ </a-form-item>
+ </a-col>
+ <!--骞存湀鏃ユ椂鍒嗙-->
+ <!--鏃堕棿鑼冨洿-->
+
+ <a-col :md="8" :sm="24">
+ <a-form-item label="鏇存柊鏃堕棿">
+ <a-range-picker style="width: 100%" :placeholder="['寮�濮嬫椂闂�', '缁撴潫鏃堕棿']" :show-time="{
+format: 'HH:mm:ss', defaultValue: [moment('00:00:00', 'HH:mm:ss'),moment('23:59:59', 'HH:mm:ss')]}" v-model="queryParam.updatedTime" value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" @change="onChangeupdatedTime"/>
+
+ </a-form-item>
+ </a-col>
+
+ <a-col :md="8" :sm="24">
+ <a-form-item label="鍒涘缓鑰呭悕绉�">
+ <a-input v-model="queryParam.createdUserName" allow-clear placeholder="璇疯緭鍏ュ垱寤鸿�呭悕绉�"/>
+ </a-form-item>
+ </a-col>
+ <a-col :md="8" :sm="24">
+ <a-form-item label="淇敼鑰呭悕绉�">
+ <a-input v-model="queryParam.updatedUserName" allow-clear placeholder="璇疯緭鍏ヤ慨鏀硅�呭悕绉�"/>
+ </a-form-item>
+ </a-col> </template>
+
+ <a-col :md="8" :sm="24" >
+ <span class="table-page-search-submitButtons">
+ <a-button type="primary" @click="$refs.table.refresh(true)" >鏌ヨ</a-button>
+ <a-button style="margin-left: 8px" @click="() => queryParam = {}">閲嶇疆</a-button>
+ <a @click="toggleAdvanced" style="margin-left: 8px"> {{ advanced ? '鏀惰捣' : '灞曞紑' }}
+ <a-icon :type="advanced ? 'up' : 'down'"/>
+ </a>
+ </span>
+ </a-col>
+
+ </a-row>
+ </a-form>
+ </div>
+ </a-card>
+ </div>
+ <a-card :bordered="false">
+ <s-table
+ ref="table"
+ :columns="columns"
+ :data="loadData"
+ :alert="true"
+ @changeTablePage="pageInfo = $event"
+ :scroll="{x: true,y:tableHeight}"
+ :rowKey="(record) => record.id"
+ :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
+ <template class="table-operator" slot="operator" v-if="hasPerm('WmsSubstituteGood:add')" >
+ <div ref="actionBar" class="actionBar">
+ <a-button type="info" v-if="hasPerm('sysExcelTemplate:importExcel')" icon="upload" @click="$refs.excelForm.index()">
+ 瀵煎叆
+ </a-button>
+ <a-button type="info" v-if="hasPerm('WmsSubstituteGood:exportExcel')" icon="download" @click="WmsSubstituteGoodToExcel()">
+ 瀵煎嚭
+ </a-button>
+ <a-button type="primary" v-if="hasPerm('WmsSubstituteGood:add')" icon="plus" @click="$refs.addForm.add()">鏂板鏇夸唬鍝佺鐞�</a-button>
+ </div>
+ </template>
+ <span slot="isDisabledscopedSlots" slot-scope="text">
+ <div v-if="text===true ">
+ <a-tag color="green">鏄�</a-tag>
+ </div>
+ <div v-else-if="text==false">
+ <a-tag color="volcano">鍚�</a-tag>
+ </div>
+ <div v-else=""></div>
+ </span>
+ <span slot="action" slot-scope="text, record">
+
+ <a v-if="hasPerm('WmsSubstituteGood:edit')" @click="$refs.editForm.edit(record)">缂栬緫</a>
+ <a-divider type="vertical" v-if="hasPerm('WmsSubstituteGood:edit') & hasPerm('WmsSubstituteGood:delete')"/>
+ <a-popconfirm v-if="hasPerm('WmsSubstituteGood:delete')" placement="topRight" title="纭鍒犻櫎锛�" @confirm="() => WmsSubstituteGoodDelete(record)">
+ <a>鍒犻櫎</a>
+ </a-popconfirm>
+ </span>
+ </s-table>
+ <add-form ref="addForm" @ok="handleOk" />
+ <edit-form ref="editForm" @ok="handleOk" />
+ <excel-form ref="excelForm" @ok="handleOk" />
+ </a-card>
+ </div>
+</template>
+<script>
+ import { STable } from '@/components'
+ import moment from 'moment'
+ import { WmsSubstituteGoodPage, WmsSubstituteGoodDelete, WmsSubstituteGoodToExcel } from '@/api/modular/main/WmsBase/WmsSubstituteGoodManage'
+ //鑷畾涔塼able楂樺害
+ import setTableHtMixin from '@/mixins/handleTableHt.js'
+ import addForm from './addForm.vue'
+ import { exportExcel } from '@/utils/exportToExcel'
+ import { downloadFile } from '@/utils/util'
+ import editForm from './editForm.vue'
+ import excelForm from './excelForm.vue'
+ export default {
+ mixins: [setTableHtMixin],
+ components: {
+ STable,
+ addForm,
+ editForm,
+ excelForm
+ },
+ data () {
+ return {
+ advanced: false, // 楂樼骇鎼滅储 灞曞紑/鍏抽棴
+ queryParam: {},
+ pageInfo: {
+ current: 1,
+ pageSize: 10
+ },
+ columns: [
+ {
+ title:'搴忓彿',
+ width: '60px',
+ align: 'center',
+ customRender: (text, record, index) => `${index + 1 + (this.pageInfo.current - 1) * this.pageInfo.pageSize}`
+ },
+ {
+ title: '鏇夸唬缂栧彿',
+ align: 'center',
+ customHeaderCell: () => {
+ return {
+ style: {
+ 'min-width': '120px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ customCell: () => {
+ return {
+ style: {
+ 'min-width': '120px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ sorter: true,
+ dataIndex: 'substituteCode'
+ },
+ {
+ title: '鐗╂枡缂栧彿',
+ align: 'center',
+ customHeaderCell: () => {
+ return {
+ style: {
+ 'min-width': '120px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ customCell: () => {
+ return {
+ style: {
+ 'min-width': '120px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ sorter: true,
+ dataIndex: 'materialCode'
+ },
+ {
+ title: '鐗╂枡鍚嶇О',
+ align: 'center',
+ customHeaderCell: () => {
+ return {
+ style: {
+ 'min-width': '120px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ customCell: () => {
+ return {
+ style: {
+ 'min-width': '120px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ sorter: true,
+ dataIndex: 'materialName'
+ },
+ {
+ title: '鏇夸唬鍝佺墿鏂欑紪鍙�',
+ align: 'center',
+ customHeaderCell: () => {
+ return {
+ style: {
+ 'min-width': '140px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ customCell: () => {
+ return {
+ style: {
+ 'min-width': '140px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ sorter: true,
+ dataIndex: 'substituteMaterialCode'
+ },
+ {
+ title: '鏇夸唬鍝佺墿鏂欏悕绉�',
+ align: 'center',
+ customHeaderCell: () => {
+ return {
+ style: {
+ 'min-width': '140px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ customCell: () => {
+ return {
+ style: {
+ 'min-width': '140px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ sorter: true,
+ dataIndex: 'substituteMaterialName'
+ },
+ {
+ title: '鏇夸唬娆″簭',
+ align: 'center',
+ customHeaderCell: () => {
+ return {
+ style: {
+ 'min-width': '120px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ customCell: () => {
+ return {
+ style: {
+ 'min-width': '120px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ sorter: true,
+ dataIndex: 'substituteIndex'
+ },
+ {
+ title: '鏄惁绂佺敤',
+ align: 'center',
+ customHeaderCell: () => {
+ return {
+ style: {
+ 'min-width': '120px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ customCell: () => {
+ return {
+ style: {
+ 'min-width': '120px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ sorter: true,
+ dataIndex: 'isDisabled',
+ scopedSlots: { customRender: 'isDisabledscopedSlots' }
+ },
+ {
+ title: '鍒涘缓鏃堕棿',
+ align: 'center',
+ customHeaderCell: () => {
+ return {
+ style: {
+ 'min-width': '120px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ customCell: () => {
+ return {
+ style: {
+ 'min-width': '120px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ sorter: true,
+ dataIndex: 'createdTime'
+ },
+ {
+ title: '鏇存柊鏃堕棿',
+ align: 'center',
+ customHeaderCell: () => {
+ return {
+ style: {
+ 'min-width': '120px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ customCell: () => {
+ return {
+ style: {
+ 'min-width': '120px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ sorter: true,
+ dataIndex: 'updatedTime'
+ },
+ {
+ title: '鍒涘缓鑰呭悕绉�',
+ align: 'center',
+ customHeaderCell: () => {
+ return {
+ style: {
+ 'min-width': '120px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ customCell: () => {
+ return {
+ style: {
+ 'min-width': '120px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ sorter: true,
+ dataIndex: 'createdUserName'
+ },
+ {
+ title: '淇敼鑰呭悕绉�',
+ align: 'center',
+ customHeaderCell: () => {
+ return {
+ style: {
+ 'min-width': '120px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ customCell: () => {
+ return {
+ style: {
+ 'min-width': '120px'//鏈�灏忓垪瀹借缃�
+ }
+ }
+ },
+ sorter: true,
+ dataIndex: 'updatedUserName'
+ }
+ ],
+ tstyle: { 'padding-bottom': '0px', 'margin-bottom': '10px' },
+ // 鍔犺浇鏁版嵁鏂规硶 蹇呴』涓� Promise 瀵硅薄
+ loadData: parameter => {
+ return WmsSubstituteGoodPage(Object.assign(parameter, this.switchingDate())).then((res) => {
+ return res.data
+ })
+ },
+ selectedRowKeys: [],
+ selectedRows: []
+ }
+ },
+ created () {
+ if (this.hasPerm('WmsSubstituteGood:edit') || this.hasPerm('WmsSubstituteGood:delete')) {
+ this.columns.push({
+ title: '鎿嶄綔',
+ width: '150px',
+ dataIndex: 'action',
+ scopedSlots: { customRender: 'action' }
+ })
+ }
+ const path = this.$route.path
+ const columnStr = window.localStorage.getItem(path)
+ if(columnStr) {
+ var _columns = JSON.parse(columnStr)
+ this.columns.forEach(element => {
+ var fObj = _columns.find((item, index) => {
+ return item.dataIndex === element.dataIndex;
+ })
+ if(fObj!=undefined && fObj!=null){
+ element.checked=fObj.checked;
+ }
+ });
+ }
+ const isDisabledOption = this.$options
+ this.isDisabledData = isDisabledOption.filters['dictData']('yes_true_false')
+
+ this.handleTableHt() //璁剧疆涓昏〃琛ㄦ牸楂樺害
+ window.addEventListener(
+ 'resize',
+ () => {
+ this.handleTableHt() // 鐩戝惉灞忓箷澶у皬鏀瑰彉琛ㄦ牸楂樺害
+ },
+ false
+ )
+
+ },
+ methods: {
+ moment,
+ /**
+ * 鏌ヨ鍙傛暟缁勮
+ */
+ switchingDate () {
+ const obj = JSON.parse(JSON.stringify(this.queryParam))
+ return obj
+ },
+ WmsSubstituteGoodDelete (record) {
+ WmsSubstituteGoodDelete(record).then((res) => {
+ if (res.success) {
+ this.$message.success('鍒犻櫎鎴愬姛')
+ this.$refs.table.refresh()
+ } else {
+ this.$message.error('鍒犻櫎澶辫触') // + res.message
+ }
+ })
+ },
+
+
+ WmsSubstituteGoodToExcel() {
+ this.loading = true
+ let entozh = {};
+ const path = this.$route.path;
+ if (window.localStorage.getItem(path)) {
+ JSON.parse(window.localStorage.getItem(path)).forEach(item => {
+ if (item.dataIndex != 'action' && item.checked) {
+ entozh[item.dataIndex] = item.title
+ }
+ })
+ } else { //鐩存帴鐐瑰鍑�
+ this.columns.forEach(item => {
+ if (item.dataIndex != 'action') {
+ entozh[item.dataIndex] = item.title
+ }
+ })
+ }
+ WmsSubstituteGoodPage(Object.assign({ pageSize: 100000, pageIndex: 1 }, this.queryParam)).then((res) => {
+ this.loading = false;
+ //闇�瑕佹埅鍙栨棩鏈熺殑瀛楁
+ var arrDataCutout = this.columns.filter(v => v.customCutout == true);
+ res.data.rows.forEach(item => {
+ var arrKeys = Object.keys(item);
+ arrKeys.forEach(key => {
+ var strFieldDic = key + 'Data';
+ //鏋氫妇杞��
+ if (this[strFieldDic] && this[strFieldDic].length > 0) {
+ let arrFieldDic = this[strFieldDic].filter(v => String(v.code) == String(item[key]));
+ if (arrFieldDic.length > 0) {
+ item[key] = arrFieldDic[0]?.name || '娌℃湁鏋氫妇鍊�';
+ }
+ }
+ // 鏃ユ湡鎴彇
+ if (arrDataCutout.length > 0) {
+ arrDataCutout.forEach(itemIn => {
+ if (key == itemIn.dataIndex && item[key]) {
+ item[key] = item[key].split(" ")[0]
+ }
+ })
+ }
+ });
+ })
+ exportExcel(res.data.rows, entozh, "xlsx", `${this.$route.meta.title}`)
+ }).catch((err) => {
+ this.loading = false
+ this.$message.error('涓嬭浇閿欒锛氳幏鍙栨枃浠舵祦閿欒' + err)
+ })
+ },
+
+
+ toggleAdvanced () {
+ this.advanced = !this.advanced
+ this.handleTableHt() //璁剧疆涓昏〃琛ㄦ牸楂樺害
+ },
+ onChangecreatedTime(date, dateString) {
+ this.queryParam.createdTime = dateString
+ },
+ onChangeupdatedTime(date, dateString) {
+ this.queryParam.updatedTime = dateString
+ },
+ handleOk () {
+ this.$refs.table.refresh()
+ },
+ onSelectChange (selectedRowKeys, selectedRows) {
+ this.selectedRowKeys = selectedRowKeys
+ this.selectedRows = selectedRows
+ }
+ }
+ }
+</script>
+<style lang="less">
+ .table-operator {
+ margin-bottom: 18px;
+ }
+ button {
+ margin-right: 8px;
+ }
+</style>
diff --git a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/Dto/WmsSubstituteGoodInput.cs b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/Dto/WmsSubstituteGoodInput.cs
new file mode 100644
index 0000000..32c1005
--- /dev/null
+++ b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/Dto/WmsSubstituteGoodInput.cs
@@ -0,0 +1,215 @@
+锘縰sing Admin.NET.Core;
+using Admin.NET.Core.Service;
+using System.ComponentModel.DataAnnotations;
+
+namespace Admin.NET.Application
+{
+
+ /// <summary>
+ /// 鏇夸唬鍝佺鐞嗘煡璇㈠弬鏁�
+ /// </summary>
+ public class WmsSubstituteGoodSearch : PageInputBase
+ {
+ /// <summary>
+ /// 鏇夸唬缂栧彿
+ /// </summary>
+ public virtual string SubstituteCode { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡缂栧彿
+ /// </summary>
+ public virtual string MaterialCode { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡鍚嶇О
+ /// </summary>
+ public virtual string MaterialName { get; set; }
+
+ /// <summary>
+ /// 鏇夸唬鍝佺墿鏂欑紪鍙�
+ /// </summary>
+ public virtual string SubstituteMaterialCode { get; set; }
+
+ /// <summary>
+ /// 鏇夸唬鍝佺墿鏂欏悕绉�
+ /// </summary>
+ public virtual string SubstituteMaterialName { get; set; }
+
+ /// <summary>
+ /// 鏇夸唬娆″簭
+ /// </summary>
+ public virtual int? SubstituteIndex { get; set; }
+
+ /// <summary>
+ /// 鏄惁绂佺敤
+ /// </summary>
+ public virtual bool? IsDisabled { get; set; }
+
+ /// <summary>
+ /// 鍒涘缓鏃堕棿
+ /// </summary>
+ public virtual List<string> CreatedTime { get; set; }
+
+ /// <summary>
+ /// 鏇存柊鏃堕棿
+ /// </summary>
+ public virtual List<string> UpdatedTime { get; set; }
+
+ /// <summary>
+ /// 鍒涘缓鑰呭悕绉�
+ /// </summary>
+ public virtual string CreatedUserName { get; set; }
+
+ /// <summary>
+ /// 淇敼鑰呭悕绉�
+ /// </summary>
+ public virtual string UpdatedUserName { get; set; }
+
+ }
+
+ /// <summary>
+ /// 鏇夸唬鍝佺鐞嗕笉鍒嗛〉鏌ヨ鍙傛暟
+ /// </summary>
+ public class WmsSubstituteGoodSearchNonPage : PageInputNonPageBase
+ {
+ /// <summary>
+ /// 鏇夸唬缂栧彿
+ /// </summary>
+ public virtual string SubstituteCode { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡缂栧彿
+ /// </summary>
+ public virtual string MaterialCode { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡鍚嶇О
+ /// </summary>
+ public virtual string MaterialName { get; set; }
+
+ /// <summary>
+ /// 鏇夸唬鍝佺墿鏂欑紪鍙�
+ /// </summary>
+ public virtual string SubstituteMaterialCode { get; set; }
+
+ /// <summary>
+ /// 鏇夸唬鍝佺墿鏂欏悕绉�
+ /// </summary>
+ public virtual string SubstituteMaterialName { get; set; }
+
+ /// <summary>
+ /// 鏇夸唬娆″簭
+ /// </summary>
+ public virtual int? SubstituteIndex { get; set; }
+
+ /// <summary>
+ /// 鏄惁绂佺敤
+ /// </summary>
+ public virtual bool? IsDisabled { get; set; }
+
+ /// <summary>
+ /// 鍒涘缓鏃堕棿
+ /// </summary>
+ public virtual List<DateTimeOffset>? CreatedTime { get; set; }
+
+ /// <summary>
+ /// 鏇存柊鏃堕棿
+ /// </summary>
+ public virtual List<DateTimeOffset>? UpdatedTime { get; set; }
+
+ /// <summary>
+ /// 鍒涘缓鑰呭悕绉�
+ /// </summary>
+ public virtual string CreatedUserName { get; set; }
+
+ /// <summary>
+ /// 淇敼鑰呭悕绉�
+ /// </summary>
+ public virtual string UpdatedUserName { get; set; }
+
+ }
+
+ /// <summary>
+ /// 鏇夸唬鍝佺鐞嗚緭鍏ュ弬鏁�
+ /// </summary>
+ public class WmsSubstituteGoodInput
+ {
+ /// <summary>
+ /// 鏇夸唬缂栧彿
+ /// </summary>
+ [Required(ErrorMessage = "鏇夸唬缂栧彿涓嶈兘涓虹┖")]
+ public virtual string SubstituteCode { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡缂栧彿
+ /// </summary>
+ [Required(ErrorMessage = "鐗╂枡缂栧彿涓嶈兘涓虹┖")]
+ public virtual string MaterialCode { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡鍚嶇О
+ /// </summary>
+ [Required(ErrorMessage = "鐗╂枡鍚嶇О涓嶈兘涓虹┖")]
+ public virtual string MaterialName { get; set; }
+
+ /// <summary>
+ /// 鏇夸唬鍝佺墿鏂欑紪鍙�
+ /// </summary>
+ [Required(ErrorMessage = "鏇夸唬鍝佺墿鏂欑紪鍙蜂笉鑳戒负绌�")]
+ public virtual string SubstituteMaterialCode { get; set; }
+
+ /// <summary>
+ /// 鏇夸唬鍝佺墿鏂欏悕绉�
+ /// </summary>
+ [Required(ErrorMessage = "鏇夸唬鍝佺墿鏂欏悕绉颁笉鑳戒负绌�")]
+ public virtual string SubstituteMaterialName { get; set; }
+
+ /// <summary>
+ /// 鏇夸唬娆″簭
+ /// </summary>
+ [Required(ErrorMessage = "鏇夸唬娆″簭涓嶈兘涓虹┖")]
+ public virtual int SubstituteIndex { get; set; }
+
+ /// <summary>
+ /// 鏄惁绂佺敤
+ /// </summary>
+ [Required(ErrorMessage = "鏄惁绂佺敤涓嶈兘涓虹┖")]
+ public virtual bool IsDisabled { get; set; }
+
+ }
+
+ /// <summary>
+ /// 鏇夸唬鍝佺鐞嗘柊澧炲弬鏁�
+ /// </summary>
+ public class AddWmsSubstituteGoodInput : WmsSubstituteGoodInput
+ {
+ }
+
+ /// <summary>
+ /// 鏇夸唬鍝佺鐞嗗垹闄ゅ弬鏁�
+ /// </summary>
+ public class DeleteWmsSubstituteGoodInput : BaseId
+ {
+ }
+
+ /// <summary>
+ /// 鏇夸唬鍝佺鐞嗘洿鏂板弬鏁�
+ /// </summary>
+ public class UpdateWmsSubstituteGoodInput : WmsSubstituteGoodInput
+ {
+ /// <summary>
+ /// Id涓婚敭
+ /// </summary>
+ [Required(ErrorMessage = "Id涓婚敭涓嶈兘涓虹┖")]
+ public long? Id { get; set; }
+
+ }
+
+ /// <summary>
+ /// 鏇夸唬鍝佺鐞嗚幏鍙栧崟涓弬鏁�
+ /// </summary>
+ public class QueryeWmsSubstituteGoodInput : BaseId
+ {
+
+ }
+}
diff --git a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/Dto/WmsSubstituteGoodOutput.cs b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/Dto/WmsSubstituteGoodOutput.cs
new file mode 100644
index 0000000..ff829a6
--- /dev/null
+++ b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/Dto/WmsSubstituteGoodOutput.cs
@@ -0,0 +1,72 @@
+锘縰sing Admin.NET.Core.Util.LowCode.Dto;
+using System;
+
+namespace Admin.NET.Application
+{
+ /// <summary>
+ /// 鏇夸唬鍝佺鐞嗚緭鍑哄弬鏁�
+ /// </summary>
+ public class WmsSubstituteGoodOutput
+ {
+ /// <summary>
+ /// 鏇夸唬缂栧彿
+ /// </summary>
+ public string SubstituteCode { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡缂栧彿
+ /// </summary>
+ public string MaterialCode { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡鍚嶇О
+ /// </summary>
+ public string MaterialName { get; set; }
+
+ /// <summary>
+ /// 鏇夸唬鍝佺墿鏂欑紪鍙�
+ /// </summary>
+ public string SubstituteMaterialCode { get; set; }
+
+ /// <summary>
+ /// 鏇夸唬鍝佺墿鏂欏悕绉�
+ /// </summary>
+ public string SubstituteMaterialName { get; set; }
+
+ /// <summary>
+ /// 鏇夸唬娆″簭
+ /// </summary>
+ public int SubstituteIndex { get; set; }
+
+ /// <summary>
+ /// 鏄惁绂佺敤
+ /// </summary>
+ public bool IsDisabled { get; set; }
+
+ /// <summary>
+ /// Id涓婚敭
+ /// </summary>
+ public long? Id { get; set; }
+
+ /// <summary>
+ /// 鍒涘缓鏃堕棿
+ /// </summary>
+ public DateTimeOffset? CreatedTime { get; set; }
+
+ /// <summary>
+ /// 鏇存柊鏃堕棿
+ /// </summary>
+ public DateTimeOffset? UpdatedTime { get; set; }
+
+ /// <summary>
+ /// 鍒涘缓鑰呭悕绉�
+ /// </summary>
+ public string CreatedUserName { get; set; }
+
+ /// <summary>
+ /// 淇敼鑰呭悕绉�
+ /// </summary>
+ public string UpdatedUserName { get; set; }
+
+ }
+}
diff --git a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/IWmsSubstituteGoodService.cs b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/IWmsSubstituteGoodService.cs
new file mode 100644
index 0000000..dbf2713
--- /dev/null
+++ b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/IWmsSubstituteGoodService.cs
@@ -0,0 +1,22 @@
+锘縰sing Admin.NET.Core;
+using Microsoft.AspNetCore.Mvc;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Http;
+
+namespace Admin.NET.Application
+{
+ public interface IWmsSubstituteGoodService
+ {
+ Task<WmsSubstituteGoodOutput> Get([FromQuery] QueryeWmsSubstituteGoodInput input);
+ Task<List<WmsSubstituteGoodOutput>> List([FromQuery] WmsSubstituteGoodInput input);
+ Task<PageResult<WmsSubstituteGoodOutput>> Page([FromQuery] WmsSubstituteGoodSearch input);
+ Task<List<WmsSubstituteGoodOutput>> ListNonPageAsync([FromQuery] WmsSubstituteGoodSearchNonPage input);
+
+ Task Add(AddWmsSubstituteGoodInput input);
+ Task Update(UpdateWmsSubstituteGoodInput input);
+ Task Delete(DeleteWmsSubstituteGoodInput input);
+ Task<int> ImportExcelAsync(IFormFile file);
+ IActionResult DownloadExcelTemplate(string version);
+ }
+}
\ No newline at end of file
diff --git a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/Map/WmsSubstituteGoodMapper.cs b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/Map/WmsSubstituteGoodMapper.cs
new file mode 100644
index 0000000..b813eff
--- /dev/null
+++ b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/Map/WmsSubstituteGoodMapper.cs
@@ -0,0 +1,18 @@
+锘縰sing Mapster;
+using Admin.NET.Core;
+
+namespace Admin.NET.Application
+{
+ public class WmsSubstituteGoodMapper : IRegister
+ {
+ public void Register(TypeAdapterConfig config)
+ {
+ config.ForType<AddWmsSubstituteGoodInput, WmsSubstituteGood>()
+ ;
+ config.ForType<UpdateWmsSubstituteGoodInput, WmsSubstituteGood>()
+ ;
+ config.ForType<WmsSubstituteGood, WmsSubstituteGoodOutput>()
+ ;
+ }
+ }
+}
diff --git a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/WmsSubstituteGoodService.cs b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/WmsSubstituteGoodService.cs
new file mode 100644
index 0000000..2f80369
--- /dev/null
+++ b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsSubstituteGood/WmsSubstituteGoodService.cs
@@ -0,0 +1,481 @@
+锘縰sing Furion.DatabaseAccessor;
+using Furion.DatabaseAccessor.Extensions;
+using Furion.DependencyInjection;
+using Furion.DynamicApiController;
+using Furion.FriendlyException;
+using Admin.NET.Core;
+using Mapster;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using System.Linq.Dynamic.Core;
+using Microsoft.AspNetCore.Http;
+using System.Text;
+using System.Web;
+using System.ComponentModel;
+using System.Data;
+namespace Admin.NET.Application
+{
+ /// <summary>
+ /// 鏇夸唬鍝佺鐞嗘湇鍔�
+ /// </summary>
+ [ApiDescriptionSettings("WmsBase", Name = "WmsSubstituteGood", Order = 100)]
+ [Route("api")]
+ public class WmsSubstituteGoodService : IWmsSubstituteGoodService, IDynamicApiController, ITransient
+ {
+ private readonly IRepository<WmsSubstituteGood,MasterDbContextLocator> _wmsSubstituteGoodRep;
+ private readonly IRepository<SysDictType, MasterDbContextLocator> _sysDictTypeRep;
+ private readonly IRepository<SysDictData, MasterDbContextLocator> _sysDictDataRep;
+ private readonly ISysExcelTemplateService _sysExcelTemplateService;
+ private readonly static object _lock = new();
+
+ public WmsSubstituteGoodService(
+ IRepository<WmsSubstituteGood,MasterDbContextLocator> wmsSubstituteGoodRep
+ ,IRepository<SysDictType, MasterDbContextLocator> sysDictTypeRep
+ ,IRepository<SysDictData, MasterDbContextLocator> sysDictDataRep
+ ,ISysExcelTemplateService sysExcelTemplateService
+ )
+ {
+ _wmsSubstituteGoodRep = wmsSubstituteGoodRep;
+ _sysDictTypeRep = sysDictTypeRep;
+ _sysDictDataRep = sysDictDataRep;
+ _sysExcelTemplateService = sysExcelTemplateService;
+ }
+
+ /// <summary>
+ /// 鍒嗛〉鏌ヨ鏇夸唬鍝佺鐞�
+ /// </summary>
+ /// <param name="input"></param>
+ /// <returns></returns>
+ [HttpGet("WmsSubstituteGood/page")]
+ public async Task<PageResult<WmsSubstituteGoodOutput>> Page([FromQuery] WmsSubstituteGoodSearch input)
+ {
+ var wmsSubstituteGoods = await _wmsSubstituteGoodRep.DetachedEntities
+ .Where(!string.IsNullOrEmpty(input.SubstituteCode), u => u.SubstituteCode == input.SubstituteCode)
+ .Where(!string.IsNullOrEmpty(input.MaterialCode), u => u.MaterialCode == input.MaterialCode)
+ .Where(!string.IsNullOrEmpty(input.MaterialName), u => u.MaterialName == input.MaterialName)
+ .Where(!string.IsNullOrEmpty(input.SubstituteMaterialCode), u => u.SubstituteMaterialCode == input.SubstituteMaterialCode)
+ .Where(!string.IsNullOrEmpty(input.SubstituteMaterialName), u => u.SubstituteMaterialName == input.SubstituteMaterialName)
+ .Where(input.SubstituteIndex != null, u => u.SubstituteIndex == input.SubstituteIndex)
+ .Where(input.IsDisabled != null, u => u.IsDisabled == input.IsDisabled)
+ .Where(input.CreatedTime!=null, u => u.CreatedTime>= Convert.ToDateTime(input.CreatedTime[0]) && u.CreatedTime<= Convert.ToDateTime(input.CreatedTime[1]))
+ .Where(input.UpdatedTime!=null, u => u.UpdatedTime>= Convert.ToDateTime(input.UpdatedTime[0]) && u.UpdatedTime<= Convert.ToDateTime(input.UpdatedTime[1]))
+ .Where(!string.IsNullOrEmpty(input.CreatedUserName), u => u.CreatedUserName == input.CreatedUserName)
+ .Where(!string.IsNullOrEmpty(input.UpdatedUserName), u => u.UpdatedUserName == input.UpdatedUserName)
+ .OrderBy(PageInputOrder.OrderBuilder<WmsSubstituteGoodSearch>(input))
+ .ProjectToType<WmsSubstituteGoodOutput>()
+ .ToADPagedListAsync(input.PageNo, input.PageSize);
+ return wmsSubstituteGoods;
+ }
+
+ /// <summary>
+ /// 涓嶅垎椤垫煡璇㈡浛浠e搧绠$悊鍒楄〃
+ /// </summary>
+ /// <param name="input">鏇夸唬鍝佺鐞嗘煡璇㈠弬鏁�</param>
+ /// <returns>(鏇夸唬鍝佺鐞�)瀹炰緥鍒楄〃</returns>
+ [HttpGet("WmsSubstituteGood/listNonPage")]
+ public async Task<List<WmsSubstituteGoodOutput>> ListNonPageAsync([FromQuery] WmsSubstituteGoodSearchNonPage input)
+ {
+ var pSubstituteCode = input.SubstituteCode?.Trim() ?? "";
+ var pMaterialCode = input.MaterialCode?.Trim() ?? "";
+ var pMaterialName = input.MaterialName?.Trim() ?? "";
+ var pSubstituteMaterialCode = input.SubstituteMaterialCode?.Trim() ?? "";
+ var pSubstituteMaterialName = input.SubstituteMaterialName?.Trim() ?? "";
+ var pSubstituteIndex = input.SubstituteIndex;
+ var pIsDisabled = input.IsDisabled;
+ var pCreatedTime = input.CreatedTime;
+ var pUpdatedTime = input.UpdatedTime;
+ var pCreatedUserName = input.CreatedUserName?.Trim() ?? "";
+ var pUpdatedUserName = input.UpdatedUserName?.Trim() ?? "";
+ var wmsSubstituteGoods = await _wmsSubstituteGoodRep.DetachedEntities
+ .Where(!string.IsNullOrEmpty(pSubstituteCode), u => u.SubstituteCode == pSubstituteCode)
+ .Where(!string.IsNullOrEmpty(pMaterialCode), u => u.MaterialCode == pMaterialCode)
+ .Where(!string.IsNullOrEmpty(pMaterialName), u => u.MaterialName == pMaterialName)
+ .Where(!string.IsNullOrEmpty(pSubstituteMaterialCode), u => u.SubstituteMaterialCode == pSubstituteMaterialCode)
+ .Where(!string.IsNullOrEmpty(pSubstituteMaterialName), u => u.SubstituteMaterialName == pSubstituteMaterialName)
+ .Where(pSubstituteIndex != null, u => u.SubstituteIndex == pSubstituteIndex)
+ .Where(pIsDisabled != null, u => u.IsDisabled == pIsDisabled)
+ .Where(input.CreatedTime!=null, u => u.CreatedTime>= Convert.ToDateTime(input.CreatedTime[0]) && u.CreatedTime<= Convert.ToDateTime(input.CreatedTime[1]))
+ .Where(input.UpdatedTime!=null, u => u.UpdatedTime>= Convert.ToDateTime(input.UpdatedTime[0]) && u.UpdatedTime<= Convert.ToDateTime(input.UpdatedTime[1]))
+ .Where(!string.IsNullOrEmpty(pCreatedUserName), u => u.CreatedUserName == pCreatedUserName)
+ .Where(!string.IsNullOrEmpty(pUpdatedUserName), u => u.UpdatedUserName == pUpdatedUserName)
+ .OrderBy(PageInputOrder.OrderNonPageBuilder(input))
+ .ProjectToType<WmsSubstituteGoodOutput>()
+ .ToListAsync();
+ return wmsSubstituteGoods;
+ }
+
+ /// <summary>
+ /// 鑾峰彇鏇夸唬鍝佺鐞�
+ /// </summary>
+ /// <param name="input"></param>
+ /// <returns></returns>
+ [HttpGet("WmsSubstituteGood/detail")]
+ public async Task<WmsSubstituteGoodOutput> Get([FromQuery] QueryeWmsSubstituteGoodInput input)
+ {
+ return (await _wmsSubstituteGoodRep.DetachedEntities.FirstOrDefaultAsync(u => u.Id == input.Id)).Adapt<WmsSubstituteGoodOutput>();
+ }
+
+ /// <summary>
+ /// 鑾峰彇鏇夸唬鍝佺鐞嗗垪琛�
+ /// </summary>
+ /// <param name="input"></param>
+ /// <returns></returns>
+ [HttpGet("WmsSubstituteGood/list")]
+ public async Task<List<WmsSubstituteGoodOutput>> List([FromQuery] WmsSubstituteGoodInput input)
+ {
+ return await _wmsSubstituteGoodRep.DetachedEntities.ProjectToType<WmsSubstituteGoodOutput>().ToListAsync();
+ }
+
+ #region 澧炪�佸垹銆佹敼
+
+ /// <summary>
+ /// 澧炲姞鏇夸唬鍝佺鐞�
+ /// </summary>
+ /// <param name="input"></param>
+ /// <returns></returns>
+ [HttpPost("WmsSubstituteGood/add")]
+ public async Task Add(AddWmsSubstituteGoodInput input)
+ {
+ var wmsSubstituteGood = input.Adapt<WmsSubstituteGood>();
+ //楠岃瘉
+ await CheckExisit(wmsSubstituteGood);
+
+ wmsSubstituteGood.CreatedUserId = wmsSubstituteGood.UpdatedUserId = SysHelper.GetUserId();
+ wmsSubstituteGood.CreatedUserName = wmsSubstituteGood.UpdatedUserName = SysHelper.GetUserName();
+ wmsSubstituteGood.CreatedTime = wmsSubstituteGood.UpdatedTime = SysHelper.GetNowTime();
+ await _wmsSubstituteGoodRep.InsertAsync(wmsSubstituteGood);
+ }
+
+ /// <summary>
+ /// 鍒犻櫎鏇夸唬鍝佺鐞�
+ /// </summary>
+ /// <param name="input"></param>
+ /// <returns></returns>
+ [HttpPost("WmsSubstituteGood/delete")]
+ public async Task Delete(DeleteWmsSubstituteGoodInput input)
+ {
+ var wmsSubstituteGood = await _wmsSubstituteGoodRep.FirstOrDefaultAsync(u => u.Id == input.Id);
+ await _wmsSubstituteGoodRep.DeleteAsync(wmsSubstituteGood);
+
+ }
+
+ /// <summary>
+ /// 鏇存柊鏇夸唬鍝佺鐞�
+ /// </summary>
+ /// <param name="input"></param>
+ /// <returns></returns>
+ [HttpPost("WmsSubstituteGood/edit")]
+ public async Task Update(UpdateWmsSubstituteGoodInput input)
+ {
+ var isExist = await _wmsSubstituteGoodRep.AnyAsync(u => u.Id == input.Id, false);
+ if (!isExist) throw Oops.Oh(ErrorCode.D1002);
+
+ var wmsSubstituteGood = input.Adapt<WmsSubstituteGood>();
+ //楠岃瘉
+ await CheckExisit(wmsSubstituteGood,true);
+
+ wmsSubstituteGood.UpdatedUserId = SysHelper.GetUserId();
+ wmsSubstituteGood.UpdatedUserName = SysHelper.GetUserName();
+ wmsSubstituteGood.UpdatedTime = SysHelper.GetNowTime();
+ await _wmsSubstituteGoodRep.UpdateAsync(wmsSubstituteGood,ignoreNullValues:true);
+ }
+
+ #endregion
+
+ #region 瀵煎叆
+
+ /// <summary>
+ /// Excel妯℃澘瀵煎叆鏇夸唬鍝佺鐞嗗姛鑳�
+ /// </summary>
+ /// <param name="file">Excel妯℃澘鏂囦欢</param>
+ /// <returns>瀵煎叆鐨勮褰曟暟</returns>
+ [HttpPost("WmsSubstituteGood/importExcel")]
+ public async Task<int> ImportExcelAsync(IFormFile file)
+ {
+ int _HeadStartLine = 2;//绗�1琛屾槸璇存槑,绗�2琛屾槸鍒楀悕
+ int _DataStartLine = 3;//绗�3琛屽紑濮嬫槸鏁版嵁
+
+ DataTable importDataTable = ExcelUtil.ImportExcelToDataTable(file, _HeadStartLine, _DataStartLine);
+ var addList =await CommonImport(importDataTable, _DataStartLine);
+
+ lock (_lock)
+ {
+ _wmsSubstituteGoodRep.InsertAsync(addList);
+
+ }
+ await Task.CompletedTask;
+ return addList.Count;
+ }
+
+ /// <summary>
+ /// DataTable杞崲瀹炰綋瀵硅薄鍒楄〃
+ /// </summary>
+ /// <param name="dataTable"></param>
+ /// <param name="dataStartLine">妯$増鍒楀悕寮�濮嬭</param>
+ /// <returns></returns>
+ private async Task<List<WmsSubstituteGood>> CommonImport(DataTable dataTable, int dataStartLine)
+ {
+
+ var details = new List<WmsSubstituteGood>();
+ int index = dataStartLine;//妯$増鍒楀悕寮�濮嬭
+ foreach (System.Data.DataRow row in dataTable.Rows)
+ {
+ index++;
+
+ //瀵煎叆妯$増瀹氬埗鍖栦唬鐮侊紙鏇挎崲妯$増浣跨敤锛�
+
+ var addItem = new WmsSubstituteGood()
+ {
+ CreatedTime = SysHelper.GetNowTime(),
+ CreatedUserId = SysHelper.GetUserId(),
+ CreatedUserName = SysHelper.GetUserName(),
+ UpdatedTime = SysHelper.GetNowTime(),
+ UpdatedUserId = SysHelper.GetUserId(),
+ UpdatedUserName = SysHelper.GetUserName()
+ };
+ #region 瀹氫箟鍙橀噺
+ var _SubstituteCode = "";//鏇夸唬缂栧彿
+ var _MaterialCode = "";//鐗╂枡缂栧彿
+ var _MaterialName = "";//鐗╂枡鍚嶇О
+ var _SubstituteMaterialCode = "";//鏇夸唬鍝佺墿鏂欑紪鍙�
+ var _SubstituteMaterialName = "";//鏇夸唬鍝佺墿鏂欏悕绉�
+ var _SubstituteIndex = "";//鏇夸唬娆″簭
+ var _IsDisabled = "";//鏄惁绂佺敤
+ var _Id = "";//Id涓婚敭
+ #endregion
+
+
+ #region 鍙栧��
+ _SubstituteCode = row["鏇夸唬缂栧彿"]?.ToString() ;
+ _MaterialCode = row["鐗╂枡缂栧彿"]?.ToString() ;
+ _MaterialName = row["鐗╂枡鍚嶇О"]?.ToString() ;
+ _SubstituteMaterialCode = row["鏇夸唬鍝佺墿鏂欑紪鍙�"]?.ToString() ;
+ _SubstituteMaterialName = row["鏇夸唬鍝佺墿鏂欏悕绉�"]?.ToString() ;
+ _SubstituteIndex = row["鏇夸唬娆″簭"]?.ToString() ;
+ _IsDisabled = row["鏄惁绂佺敤"]?.ToString() ;
+ _Id = row["Id涓婚敭"]?.ToString() ;
+ #endregion
+
+
+ #region 楠岃瘉
+
+ if (string.IsNullOrEmpty(_SubstituteCode))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鏇夸唬缂栧彿]{_SubstituteCode}涓嶈兘涓虹┖锛�");
+ }
+
+ if(!string.IsNullOrEmpty(_SubstituteCode))
+ {
+ addItem.SubstituteCode = (string)_SubstituteCode;
+ }
+
+ if (string.IsNullOrEmpty(_MaterialCode))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鐗╂枡缂栧彿]{_MaterialCode}涓嶈兘涓虹┖锛�");
+ }
+
+ if(!string.IsNullOrEmpty(_MaterialCode))
+ {
+ addItem.MaterialCode = (string)_MaterialCode;
+ }
+
+ if (string.IsNullOrEmpty(_MaterialName))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鐗╂枡鍚嶇О]{_MaterialName}涓嶈兘涓虹┖锛�");
+ }
+
+ if(!string.IsNullOrEmpty(_MaterialName))
+ {
+ addItem.MaterialName = (string)_MaterialName;
+ }
+
+ if (string.IsNullOrEmpty(_SubstituteMaterialCode))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鏇夸唬鍝佺墿鏂欑紪鍙穄{_SubstituteMaterialCode}涓嶈兘涓虹┖锛�");
+ }
+
+ if(!string.IsNullOrEmpty(_SubstituteMaterialCode))
+ {
+ addItem.SubstituteMaterialCode = (string)_SubstituteMaterialCode;
+ }
+
+ if (string.IsNullOrEmpty(_SubstituteMaterialName))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鏇夸唬鍝佺墿鏂欏悕绉癩{_SubstituteMaterialName}涓嶈兘涓虹┖锛�");
+ }
+
+ if(!string.IsNullOrEmpty(_SubstituteMaterialName))
+ {
+ addItem.SubstituteMaterialName = (string)_SubstituteMaterialName;
+ }
+
+ if (string.IsNullOrEmpty(_SubstituteIndex))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鏇夸唬娆″簭]{_SubstituteIndex}涓嶈兘涓虹┖锛�");
+ }
+
+ if(!string.IsNullOrEmpty(_SubstituteIndex))
+ {
+ if (!int.TryParse(_SubstituteIndex, out int outSubstituteIndex)&&!string.IsNullOrEmpty(_SubstituteIndex))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鏇夸唬娆″簭]{_SubstituteIndex}鍊间笉姝g‘锛�");
+ }
+ if (outSubstituteIndex <= 0&&!string.IsNullOrEmpty(_SubstituteIndex))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鏇夸唬娆″簭]{_SubstituteIndex}鍊间笉鑳藉皬浜庣瓑浜�0锛�");
+ }
+ else
+ {
+ addItem.SubstituteIndex = outSubstituteIndex;
+ }
+
+ }
+
+ if (string.IsNullOrEmpty(_IsDisabled))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鏄惁绂佺敤]{_IsDisabled}涓嶈兘涓虹┖锛�");
+ }
+
+ if(!string.IsNullOrEmpty(_IsDisabled))
+ {
+ if(!_IsDisabled.Equals("鏄�") && !_IsDisabled.Equals("鍚�"))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鏄惁绂佺敤]{_IsDisabled}鍊间笉姝g‘锛�");
+ }
+ else
+ {
+ bool outIsDisabled = _IsDisabled.Equals("鏄�") ? true : false;
+ addItem.IsDisabled = outIsDisabled;
+ }
+ }
+
+ if(!string.IsNullOrEmpty(_Id))
+ {
+ if (!long.TryParse(_Id, out long outId)&&!string.IsNullOrEmpty(_Id))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾Id涓婚敭]{_Id}鍊间笉姝g‘锛�");
+ }
+ if (outId <= 0&&!string.IsNullOrEmpty(_Id))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾Id涓婚敭]{_Id}鍊间笉鑳藉皬浜庣瓑浜�0锛�");
+ }
+ else
+ {
+ addItem.Id = outId;
+ }
+
+ }
+ #endregion
+
+
+
+ details.Add(addItem);
+ }
+ //楠岄噸
+ await CheckExisitForImport(details);
+
+ return details;
+ }
+
+ /// <summary>
+ /// 鏍规嵁鐗堟湰涓嬭浇鏇夸唬鍝佺鐞嗙殑Excel瀵煎叆妯℃澘
+ /// </summary>
+ /// <param name="version">妯℃澘鐗堟湰</param>
+ /// <returns>涓嬭浇鐨勬ā鏉挎枃浠�</returns>
+ [HttpGet("WmsSubstituteGood/downloadExcelTemplate")]
+ public IActionResult DownloadExcelTemplate([FromQuery] string version)
+ {
+ string _path = TemplateConst.EXCEL_TEMPLATEFILE_瀵煎叆妯$増璺緞 + $"\\WmsSubstituteGood{TemplateConst.EXCEL_TEMPLATEFILE_瀵煎叆妯$増鍚嶇О鍚庣紑}.xlsx";
+ var fileName = HttpUtility.UrlEncode($"瀵煎叆妯℃澘(鏇夸唬鍝佺鐞�).xlsx", Encoding.GetEncoding("UTF-8"));
+ return new FileStreamResult(new FileStream(_path, FileMode.Open), "application/octet-stream") { FileDownloadName = fileName };
+ }
+
+ #endregion
+
+ #region 绉佹湁鏂规硶
+
+ /// <summary>
+ /// 鏍规嵁鑱斿悎涓婚敭楠岃瘉鏁版嵁鏄惁宸插瓨鍦�-鏁版嵁搴�
+ /// </summary>
+ /// <param name="input"></param>
+ /// <param name="isEdit"></param>
+ /// <returns></returns>
+ private async Task CheckExisit( WmsSubstituteGood input,bool isEdit=false)
+ {
+
+
+
+ bool isExist = false;
+ if (!isEdit)//鏂板
+ {
+ //鏁版嵁鏄惁瀛樺湪閲嶅
+ isExist = await _wmsSubstituteGoodRep.AnyAsync(u =>
+ u.SubstituteCode.Equals(input.SubstituteCode)
+ ,false);
+ }
+ else//缂栬緫
+ {
+
+
+
+ //褰撳墠缂栬緫鏁版嵁浠ュ鏄惁瀛樺湪閲嶅
+ isExist = await _wmsSubstituteGoodRep.AnyAsync(u =>
+ u.Id != input.Id
+ &&u.SubstituteCode.Equals(input.SubstituteCode)
+ ,false);
+ }
+
+
+
+ if (isExist) throw Oops.Oh(ErrorCode.E0001);
+ }
+
+ /// <summary>
+ /// 鏍规嵁鑱斿悎涓婚敭楠岃瘉鏁版嵁鏄惁宸插瓨鍦�-瀵煎叆鏃堕獙璇�
+ /// </summary>
+ /// <param name="inputs"></param>
+ /// <returns></returns>
+ private async Task CheckExisitForImport(List<WmsSubstituteGood> inputs)
+ {
+ //鏍规嵁鑱斿悎涓婚敭楠岃瘉琛ㄦ牸涓腑鏄惁宸插瓨鍦ㄧ浉鍚屾暟鎹�
+ if (inputs?.Count <= 0)
+ {
+ throw Oops.Oh($"瀵煎叆鏁版嵁涓嶈兘涓虹┖");
+ }
+ //鏁版嵁鏄惁閲嶅
+ var existExcelItem = inputs.GroupBy(g => new {
+ g.SubstituteCode
+ })
+ .Where(g => g.Count() > 1)
+ .Select(s => new {
+ s.Key.SubstituteCode
+ }).FirstOrDefault();
+ if (existExcelItem != null)
+ {
+ var wmsSubstituteGood = existExcelItem.Adapt<WmsSubstituteGood>();
+ var item= existExcelItem.Adapt<WmsSubstituteGood>();
+ throw Oops.Oh($"瀵煎叆鐨勮〃鏍间腑,鏇夸唬缂栧彿[{item.SubstituteCode}]宸插瓨鍦�");
+ }
+
+
+
+
+ //鏍规嵁鑱斿悎涓婚敭楠岃瘉鏁版嵁搴撲腑鏄惁宸插瓨鍦ㄧ浉鍚屾暟鎹�
+ var existDBItem = await _wmsSubstituteGoodRep.DetachedEntities.FirstOrDefaultAsync(w=>
+ inputs.Select(s=>""
+ +s.SubstituteCode
+ )
+ .Contains(""
+ +w.SubstituteCode
+ ));
+ if (existDBItem != null)
+ {
+ var wmsSubstituteGood = existExcelItem.Adapt<WmsSubstituteGood>();
+ var item= existExcelItem.Adapt<WmsSubstituteGood>();
+ throw Oops.Oh($"绯荤粺涓�,鏇夸唬缂栧彿[{item.SubstituteCode}]宸插瓨鍦�");
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Web.Entry/wwwroot/ExcelTemplateFile/WmsSubstituteGoodImport.xlsx b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Web.Entry/wwwroot/ExcelTemplateFile/WmsSubstituteGoodImport.xlsx
new file mode 100644
index 0000000..6c73b53
--- /dev/null
+++ b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Web.Entry/wwwroot/ExcelTemplateFile/WmsSubstituteGoodImport.xlsx
Binary files differ
--
Gitblit v1.9.3