From 5ae700afd7763cc2338564753ce22a964f4b6439 Mon Sep 17 00:00:00 2001 From: zs <zhousong@weben-smart.com> Date: 周四, 08 5月 2025 17:44:10 +0800 Subject: [PATCH] 页面修改 --- HIAWms/server/src/CMS.Plugin.HIAWms.Domain/WmsInOutStockOrder/IWmsInOutStockOrderRepository.cs | 10 HIAWms/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsMaterialStockAppService.cs | 19 HIAWms/hiawms_web/src/widgets/WmsInOutStockOrder/Controllers/WmsInOutStockOrderDrawer.tsx | 222 ++++---- HIAWms/hiawms_web/src/widgets/WmsMaterialStock/Controllers/WmsMaterialStockDrawer.tsx | 5 HIAWms/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsInOutStockOrderAppService.cs | 657 ++++++++++++----------- HIAWms/hiawms_web/src/widgets/WmsMaterialContainer/Views/Pages/WmsMaterialContainer/WmsMaterialContainer.tsx | 60 + HIAWms/server/src/CMS.Plugin.HIAWms.EntityFrameworkCore/Repositories/EfCoreWmsInOutStockOrderRepository.cs | 29 + HIAWms/hiawms_web/src/widgets/WmsInOutStockRecord/Controllers/WmsInOutStockRecord.ts | 557 ++++++++++---------- HIAWms/hiawms_web/src/widgets/WmsTask/Controllers/WmsTaskQueryDrawer.tsx | 2 9 files changed, 829 insertions(+), 732 deletions(-) diff --git a/HIAWms/hiawms_web/src/widgets/WmsInOutStockOrder/Controllers/WmsInOutStockOrderDrawer.tsx b/HIAWms/hiawms_web/src/widgets/WmsInOutStockOrder/Controllers/WmsInOutStockOrderDrawer.tsx index a7e8f75..4ea7863 100644 --- a/HIAWms/hiawms_web/src/widgets/WmsInOutStockOrder/Controllers/WmsInOutStockOrderDrawer.tsx +++ b/HIAWms/hiawms_web/src/widgets/WmsInOutStockOrder/Controllers/WmsInOutStockOrderDrawer.tsx @@ -77,21 +77,52 @@ * 娣诲姞鐨刦orm瀛楁 */ const formItems = reactive([ + // { + // label: '鍗曟嵁缂栧彿', + // prop: 'orderNo', + // el: 'input', + // disabled: disabled, + // placeholder: '璇疯緭鍏ュ崟鎹紪鍙�', + // rules: [{ required: true, message: '鍗曟嵁缂栧彿涓嶈兘涓虹┖', trigger: 'blur' }], + // }, + // { + // label: '鍗曟嵁鐘舵��', + // prop: 'orderStatus', + // el: 'select', + // disabled: disabled, + // placeholder: '璇疯緭鍏ュ崟鎹姸鎬�', + // rules: [{ required: true, message: '鍗曟嵁鐘舵�佷笉鑳戒负绌�', trigger: 'blur' }], + // }, + { - label: '鍗曟嵁缂栧彿', - prop: 'orderNo', - el: 'input', - disabled: disabled, - placeholder: '璇疯緭鍏ュ崟鎹紪鍙�', - rules: [{ required: true, message: '鍗曟嵁缂栧彿涓嶈兘涓虹┖', trigger: 'blur' }], - }, - { - label: '鍗曟嵁鐘舵��', - prop: 'orderStatus', + label: '鍗曟嵁绫诲瀷', + prop: 'orderType', el: 'select', disabled: disabled, - placeholder: '璇疯緭鍏ュ崟鎹姸鎬�', - rules: [{ required: true, message: '鍗曟嵁鐘舵�佷笉鑳戒负绌�', trigger: 'blur' }], + placeholder: '璇疯緭鍏ュ崟鎹被鍨�', + rules: [{ required: true, message: '鍗曟嵁绫诲瀷涓嶈兘涓虹┖', trigger: 'blur' }], + }, + // { + // label: '鎿嶄綔绫诲瀷', + // prop: 'stockType', + // el: 'select', + // disabled: disabled, + // placeholder: '璇疯緭鍏ユ搷浣滅被鍨�', + // rules: [ + // { + // required: true, + // message: '鎿嶄綔绫诲瀷涓嶈兘涓虹┖', + // trigger: 'blur', + // }, + // ], + // }, + { + label: '鐗╂枡缂栧彿', + prop: 'materialNo', + el: 'input', + disabled: disabled, + placeholder: '璇疯緭鍏ョ墿鏂欑紪鍙�', + rules: [{ required: true, message: '鐗╂枡缂栧彿涓嶈兘涓虹┖', trigger: 'blur' }], }, { label: '鐗╂枡鍚嶇О', @@ -101,49 +132,12 @@ placeholder: '璇疯緭鍏ョ墿鏂欏悕绉�', }, { - label: '鐗╂枡浠跺彿', - prop: 'materialNo', - el: 'input', - disabled: disabled, - placeholder: '璇疯緭鍏ョ墿鏂欎欢鍙�', - rules: [{ required: true, message: '鐗╂枡浠跺彿涓嶈兘涓虹┖', trigger: 'blur' }], - }, - { - label: '鍨嬪彿', - prop: 'materialModel', - el: 'input', - disabled: disabled, - placeholder: '璇疯緭鍏ュ瀷鍙�', - }, - { label: '鎵规鍙�', prop: 'materialBatch', el: 'input', disabled: disabled, placeholder: '璇疯緭鍏ユ壒娆″彿', rules: [{ required: true, message: '鎵规鍙蜂笉鑳戒负绌�', trigger: 'blur' }], - }, - { - label: '鍗曟嵁绫诲瀷', - prop: 'orderType', - el: 'select', - disabled: disabled, - placeholder: '璇疯緭鍏ュ崟鎹被鍨�', - rules: [{ required: true, message: '鍗曟嵁绫诲瀷涓嶈兘涓虹┖', trigger: 'blur' }], - }, - { - label: '鎿嶄綔绫诲瀷', - prop: 'stockType', - el: 'select', - disabled: disabled, - placeholder: '璇疯緭鍏ユ搷浣滅被鍨�', - rules: [ - { - required: true, - message: '鎿嶄綔绫诲瀷涓嶈兘涓虹┖', - trigger: 'blur', - }, - ], }, { label: '鍗曟嵁鏁伴噺', @@ -162,57 +156,57 @@ placeholder: '璇疯緭鍏ュ崟鎹暟閲�', rules: [{ required: true, message: '鍗曟嵁鏁伴噺涓嶈兘涓虹┖', trigger: 'blur' }], }, - { - label: '涓嬪彂鏁伴噺', - prop: 'distributeNumber', - el: (props: any, { attrs }: SetupContext) => { - return h(inputNumber, { - ...props, - clearable: true, - ...attrs, - }) - }, - width: '100%', - step: 1, - precision: 0, - disabled: disabled, - placeholder: '璇疯緭鍏ヤ笅鍙戞暟閲�', - rules: [{ required: true, message: '涓嬪彂鏁伴噺涓嶈兘涓虹┖', trigger: 'blur' }], - }, - { - label: '瀹屾垚鏁伴噺', - prop: 'completeNumber', - el: (props: any, { attrs }: SetupContext) => { - return h(inputNumber, { - ...props, - clearable: true, - ...attrs, - }) - }, - width: '100%', - step: 1, - precision: 0, - disabled: disabled, - placeholder: '璇疯緭鍏ュ畬鎴愭暟閲�', - rules: [{ required: true, message: '瀹屾垚鏁伴噺涓嶈兘涓虹┖', trigger: 'blur' }], - }, - { - label: '浼樺厛绾�', - prop: 'priority', - el: (props: any, { attrs }: SetupContext) => { - return h(inputNumber, { - ...props, - clearable: true, - ...attrs, - }) - }, - width: '100%', - step: 1, - precision: 0, - //disabled: disabled, - placeholder: '璇疯緭鍏ヤ紭鍏堢骇', - rules: [{ required: true, message: '浼樺厛绾т笉鑳戒负绌�', trigger: 'blur' }], - }, + // { + // label: '涓嬪彂鏁伴噺', + // prop: 'distributeNumber', + // el: (props: any, { attrs }: SetupContext) => { + // return h(inputNumber, { + // ...props, + // clearable: true, + // ...attrs, + // }) + // }, + // width: '100%', + // step: 1, + // precision: 0, + // disabled: disabled, + // placeholder: '璇疯緭鍏ヤ笅鍙戞暟閲�', + // rules: [{ required: true, message: '涓嬪彂鏁伴噺涓嶈兘涓虹┖', trigger: 'blur' }], + // }, + // { + // label: '瀹屾垚鏁伴噺', + // prop: 'completeNumber', + // el: (props: any, { attrs }: SetupContext) => { + // return h(inputNumber, { + // ...props, + // clearable: true, + // ...attrs, + // }) + // }, + // width: '100%', + // step: 1, + // precision: 0, + // disabled: disabled, + // placeholder: '璇疯緭鍏ュ畬鎴愭暟閲�', + // rules: [{ required: true, message: '瀹屾垚鏁伴噺涓嶈兘涓虹┖', trigger: 'blur' }], + // }, + // { + // label: '浼樺厛绾�', + // prop: 'priority', + // el: (props: any, { attrs }: SetupContext) => { + // return h(inputNumber, { + // ...props, + // clearable: true, + // ...attrs, + // }) + // }, + // width: '100%', + // step: 1, + // precision: 0, + // //disabled: disabled, + // placeholder: '璇疯緭鍏ヤ紭鍏堢骇', + // rules: [{ required: true, message: '浼樺厛绾т笉鑳戒负绌�', trigger: 'blur' }], + // }, { label: '鍏宠仈璁″垝缂栧彿', prop: 'planNo', @@ -220,20 +214,20 @@ disabled: disabled, placeholder: '璇疯緭鍏ュ叧鑱旇鍒掔紪鍙�', }, - { - label: '鎿嶄綔鏃堕棿', - prop: 'operateTime', - el: (props: any, { attrs }: SetupContext) => { - return h(dateTimePicker, { - ...props, - clearable: true, - ...attrs, - }) - }, - width: '100%', - //disabled: disabled, - placeholder: '璇疯緭鍏ユ搷浣滄椂闂�', - }, + // { + // label: '鎿嶄綔鏃堕棿', + // prop: 'operateTime', + // el: (props: any, { attrs }: SetupContext) => { + // return h(dateTimePicker, { + // ...props, + // clearable: true, + // ...attrs, + // }) + // }, + // width: '100%', + // //disabled: disabled, + // placeholder: '璇疯緭鍏ユ搷浣滄椂闂�', + // }, { label: '澶囨敞', prop: 'remark', diff --git a/HIAWms/hiawms_web/src/widgets/WmsInOutStockRecord/Controllers/WmsInOutStockRecord.ts b/HIAWms/hiawms_web/src/widgets/WmsInOutStockRecord/Controllers/WmsInOutStockRecord.ts index 039bb46..9c4a213 100644 --- a/HIAWms/hiawms_web/src/widgets/WmsInOutStockRecord/Controllers/WmsInOutStockRecord.ts +++ b/HIAWms/hiawms_web/src/widgets/WmsInOutStockRecord/Controllers/WmsInOutStockRecord.ts @@ -1,275 +1,282 @@ -import { ref, onMounted, reactive, Ref, nextTick, computed } from 'vue' -import { injectModel } from '@/libs/Provider/Provider' -import { WmsInOutStockRecord } from '../Models/WmsInOutStockRecord' -import { ElMessage } from 'element-plus' -import { ConfirmBox } from '@/components/ConfirmBox/ConfirmBox' -import { useFile } from './File' - -interface CurrentType { - row: any - index: number -} -export const useWmsInOutStockRecord = (props: any, ctx?: any) => { - const wmsInOutStockRecord = injectModel<WmsInOutStockRecord>('wmsInOutStockRecord') - const { exportFile } = useFile() - /** - * 澶撮儴閰嶇疆 - */ - const headers = ref({}) - /** - * 鍔ㄦ�佸垪閰嶇疆 - */ - const wmsInOutStockRecordColumns = ref<Record<string, any>>([]) - /** - * 鎼滅储鍊� - */ - const search = ref('') - - /** - * 鎺掑簭 - */ - const sort = ref(0) - /** - * 閫夋嫨椤� - */ - const selection = ref([]) - /** - * 褰撳墠閫変腑鐨勮 - */ - const current = ref<any>(null) - /** - * 鏁版嵁婧� - */ - const dataSource: Ref<any[]> = ref([]) - - /** - * 琛ㄦ牸 - */ - const tableRef = ref() - const dialogConfig = reactive({ - visible: false, - title: '', - isAdd: false, - }) - const dialogConfigForQuery = reactive({ - visible: false, - title: '', - isAdd: false, - }) - - - const dialogSettingConfig = reactive({ - visible: false, - title: '', - }) - - /** - * 鍒嗛〉鏁版嵁 - */ - const paginationParams = ref({}) - - /** - * 鎵撳紑璇︽儏 - * @param row - */ - const openDetail = (row: any) => { - current.value = row - dialogConfig.visible = true - dialogConfig.title = row.name - dialogConfig.isAdd = false - sort.value = row.sort - } - - const contextMenu = [ - { - label: '灞曞紑璇︽儏', - fn: (c: CurrentType) => { - current.value = null - sort.value = c.row.sort - nextTick(() => openDetail(c.row)) - }, - divided: true, - icon: 'o', - }, - // { - // label: '鍚戜笂娣诲姞', - // fn: (c: CurrentType, pageNum: number) => { - // current.value = null - // sort.value = c.index + 1 + (pageNum - 1) * 50 - // dialogConfig.visible = true - // dialogConfig.title = '娣诲姞' - // dialogConfig.isAdd = false - // }, - // divided: true, - // icon: 'up', - // }, - // { - // label: '鍚戜笅娣诲姞', - // fn: (c: CurrentType, pageNum: number) => { - // current.value = null - // sort.value = c.index + 2 + (pageNum - 1) * 50 - // dialogConfig.visible = true - // dialogConfig.title = '娣诲姞' - // dialogConfig.isAdd = false - // }, - // divided: true, - // icon: 'down', - // }, - // { - // label: '鍒涘缓鍓湰', - // fn: async ({ row }: CurrentType) => { - // await wmsInOutStockRecord.cloneData([row.id]) - // ElMessage.success('鍒涘缓鍓湰鎴愬姛') - // tableRef.value?.getList() - // }, - // divided: true, - // icon: 'copy', - // }, - { - label: '鍒犻櫎', - fn: async (c: CurrentType) => { - const names = selection.value.map((item: { id: string }) => item.id) - ConfirmBox( - `鏄惁鍒犻櫎${names.length ? names.join(',') : c.row.id}` - ).then(async () => { - const ids = selection.value.map((item: { id: string }) => item.id) - await wmsInOutStockRecord.deleteWmsInOutStockRecords(ids.length ? ids : [c.row.id]) - ElMessage.success('鍒犻櫎鎴愬姛') - tableRef.value.getList() - }) - }, - icon: 'close', - }, - ] - - const onCheck = (records: any) => { - selection.value = records - } - - const onAddWmsInOutStockRecord = () => { - const params = tableRef.value?.getPaginationParams() - current.value = null - dialogConfig.visible = true - dialogConfig.isAdd = true - dialogConfig.title = '娣诲姞' - sort.value = params.totalCount + 1 - } - - //鐐瑰嚮鎸夐挳銆愰珮绾ф煡璇€�� - const onAdvancedQuery = () => { - const params = tableRef.value?.getPaginationParams() - current.value = null - dialogConfigForQuery.visible = true - dialogConfigForQuery.isAdd = true - dialogConfigForQuery.title = '楂樼骇鏌ヨ' - } - - const onConfirmWmsInOutStockRecord = async () => { - dialogConfig.visible = false - if (dialogConfig.isAdd) { - tableRef.value?.scrollToRow({ - skip: true, - }) - } else { - await tableRef.value?.getList() - } - } - /** - * 琛岀偣鍑绘椂鏇存柊current - */ - const onRowClick = ({ row }: any) => { - if (dialogConfig.visible && current.value) { - current.value = row - } - } - /** - * 瀵煎嚭 - */ - const onExport = (data={}) => { - //const params = tableRef.value?.getParams() - exportFile('/api/v1/HIAWms/wmsInOutStockRecord/export', data, 'wmsInOutStockRecord') - } - - /** - * 鍏抽敭瀛楁悳绱� - */ - const onSearch = () => { - tableRef.value?.getList({ - Filter: search.value, - }) - } - - /** - * 閲嶇疆琛ㄦ牸鏁版嵁 - */ - const reloadList = () => { - tableRef.value?.getList() - } - /** - * 涓婁紶鎴愬姛 - */ - const onSuccess = () => { - tableRef.value?.getList() - ElMessage.success('瀵煎叆鎴愬姛') - } - /** - * 澶辫触 - * @param err - */ - const onError = (err: any) => { - try { - const message = JSON.parse(err.message) - ElMessage.error(message.msg) - } catch (error) { - ElMessage.error('瀵煎叆澶辫触') - } - } - /** - * 涓婁紶閽╁瓙 - */ - const onBeforeUpload = (file: File) => { - const format = ['xlsx', 'xls', 'csv'] - if (!format.includes(file.name.split('.')[1])) { - ElMessage.error('瀵煎叆鏂囦欢鏍煎紡涓嶆纭紝璇峰鍏�.xlsx/.xls涓�.csv鏍煎紡鐨勬枃浠�') - return false - } - return true - } - - onMounted(() => { - headers.value = { - Authorization: `Bearer ${sessionStorage.getItem('Token')}`, - 'X-Project': sessionStorage.getItem('X-Project'), - } - }) - - ctx.expose({ - reloadList, - }) - - return { - dataSource, - contextMenu, - dialogConfig, - dialogConfigForQuery, - dialogSettingConfig, - tableRef, - current, - search, - sort, - wmsInOutStockRecordColumns, - paginationParams, - headers, - onBeforeUpload, - onError, - onSuccess, - openDetail, - onSearch, - onExport, - onRowClick, - onConfirmWmsInOutStockRecord, - onCheck, - onAddWmsInOutStockRecord, - onAdvancedQuery - } -} +import { ref, onMounted, reactive, Ref, nextTick, computed } from 'vue' +import { injectModel } from '@/libs/Provider/Provider' +import { WmsInOutStockRecord } from '../Models/WmsInOutStockRecord' +import { ElMessage } from 'element-plus' +import { ConfirmBox } from '@/components/ConfirmBox/ConfirmBox' +import { useFile } from './File' + +interface CurrentType { + row: any + index: number +} +export const useWmsInOutStockRecord = (props: any, ctx?: any) => { + const wmsInOutStockRecord = injectModel<WmsInOutStockRecord>( + 'wmsInOutStockRecord' + ) + const { exportFile } = useFile() + /** + * 澶撮儴閰嶇疆 + */ + const headers = ref({}) + /** + * 鍔ㄦ�佸垪閰嶇疆 + */ + const wmsInOutStockRecordColumns = ref<Record<string, any>>([]) + /** + * 鎼滅储鍊� + */ + const search = ref('') + + /** + * 鎺掑簭 + */ + const sort = ref(0) + /** + * 閫夋嫨椤� + */ + const selection = ref([]) + /** + * 褰撳墠閫変腑鐨勮 + */ + const current = ref<any>(null) + /** + * 鏁版嵁婧� + */ + const dataSource: Ref<any[]> = ref([]) + + /** + * 琛ㄦ牸 + */ + const tableRef = ref() + const dialogConfig = reactive({ + visible: false, + title: '', + isAdd: false, + }) + const dialogConfigForQuery = reactive({ + visible: false, + title: '', + isAdd: false, + }) + + const dialogSettingConfig = reactive({ + visible: false, + title: '', + }) + + /** + * 鍒嗛〉鏁版嵁 + */ + const paginationParams = ref({}) + + /** + * 鎵撳紑璇︽儏 + * @param row + */ + const openDetail = (row: any) => { + current.value = row + dialogConfig.visible = true + dialogConfig.title = row.name + dialogConfig.isAdd = false + sort.value = row.sort + } + + const contextMenu = [ + // { + // label: '灞曞紑璇︽儏', + // fn: (c: CurrentType) => { + // current.value = null + // sort.value = c.row.sort + // nextTick(() => openDetail(c.row)) + // }, + // divided: true, + // icon: 'o', + // }, + // { + // label: '鍚戜笂娣诲姞', + // fn: (c: CurrentType, pageNum: number) => { + // current.value = null + // sort.value = c.index + 1 + (pageNum - 1) * 50 + // dialogConfig.visible = true + // dialogConfig.title = '娣诲姞' + // dialogConfig.isAdd = false + // }, + // divided: true, + // icon: 'up', + // }, + // { + // label: '鍚戜笅娣诲姞', + // fn: (c: CurrentType, pageNum: number) => { + // current.value = null + // sort.value = c.index + 2 + (pageNum - 1) * 50 + // dialogConfig.visible = true + // dialogConfig.title = '娣诲姞' + // dialogConfig.isAdd = false + // }, + // divided: true, + // icon: 'down', + // }, + // { + // label: '鍒涘缓鍓湰', + // fn: async ({ row }: CurrentType) => { + // await wmsInOutStockRecord.cloneData([row.id]) + // ElMessage.success('鍒涘缓鍓湰鎴愬姛') + // tableRef.value?.getList() + // }, + // divided: true, + // icon: 'copy', + // }, + { + label: '鍒犻櫎', + fn: async (c: CurrentType) => { + const names = selection.value.map((item: { id: string }) => item.id) + ConfirmBox(`鏄惁鍒犻櫎${names.length ? names.join(',') : c.row.id}`).then( + async () => { + const ids = selection.value.map((item: { id: string }) => item.id) + await wmsInOutStockRecord.deleteWmsInOutStockRecords( + ids.length ? ids : [c.row.id] + ) + ElMessage.success('鍒犻櫎鎴愬姛') + tableRef.value.getList() + } + ) + }, + icon: 'close', + }, + ] + + const onCheck = (records: any) => { + selection.value = records + } + + const onAddWmsInOutStockRecord = () => { + const params = tableRef.value?.getPaginationParams() + current.value = null + dialogConfig.visible = true + dialogConfig.isAdd = true + dialogConfig.title = '娣诲姞' + sort.value = params.totalCount + 1 + } + + //鐐瑰嚮鎸夐挳銆愰珮绾ф煡璇€�� + const onAdvancedQuery = () => { + const params = tableRef.value?.getPaginationParams() + current.value = null + dialogConfigForQuery.visible = true + dialogConfigForQuery.isAdd = true + dialogConfigForQuery.title = '楂樼骇鏌ヨ' + } + + const onConfirmWmsInOutStockRecord = async () => { + dialogConfig.visible = false + if (dialogConfig.isAdd) { + tableRef.value?.scrollToRow({ + skip: true, + }) + } else { + await tableRef.value?.getList() + } + } + /** + * 琛岀偣鍑绘椂鏇存柊current + */ + const onRowClick = ({ row }: any) => { + if (dialogConfig.visible && current.value) { + current.value = row + } + } + /** + * 瀵煎嚭 + */ + const onExport = (data = {}) => { + //const params = tableRef.value?.getParams() + exportFile( + '/api/v1/HIAWms/wmsInOutStockRecord/export', + data, + 'wmsInOutStockRecord' + ) + } + + /** + * 鍏抽敭瀛楁悳绱� + */ + const onSearch = () => { + tableRef.value?.getList({ + Filter: search.value, + }) + } + + /** + * 閲嶇疆琛ㄦ牸鏁版嵁 + */ + const reloadList = () => { + tableRef.value?.getList() + } + /** + * 涓婁紶鎴愬姛 + */ + const onSuccess = () => { + tableRef.value?.getList() + ElMessage.success('瀵煎叆鎴愬姛') + } + /** + * 澶辫触 + * @param err + */ + const onError = (err: any) => { + try { + const message = JSON.parse(err.message) + ElMessage.error(message.msg) + } catch (error) { + ElMessage.error('瀵煎叆澶辫触') + } + } + /** + * 涓婁紶閽╁瓙 + */ + const onBeforeUpload = (file: File) => { + const format = ['xlsx', 'xls', 'csv'] + if (!format.includes(file.name.split('.')[1])) { + ElMessage.error('瀵煎叆鏂囦欢鏍煎紡涓嶆纭紝璇峰鍏�.xlsx/.xls涓�.csv鏍煎紡鐨勬枃浠�') + return false + } + return true + } + + onMounted(() => { + headers.value = { + Authorization: `Bearer ${sessionStorage.getItem('Token')}`, + 'X-Project': sessionStorage.getItem('X-Project'), + } + }) + + ctx.expose({ + reloadList, + }) + + return { + dataSource, + contextMenu, + dialogConfig, + dialogConfigForQuery, + dialogSettingConfig, + tableRef, + current, + search, + sort, + wmsInOutStockRecordColumns, + paginationParams, + headers, + onBeforeUpload, + onError, + onSuccess, + openDetail, + onSearch, + onExport, + onRowClick, + onConfirmWmsInOutStockRecord, + onCheck, + onAddWmsInOutStockRecord, + onAdvancedQuery, + } +} diff --git a/HIAWms/hiawms_web/src/widgets/WmsMaterialContainer/Views/Pages/WmsMaterialContainer/WmsMaterialContainer.tsx b/HIAWms/hiawms_web/src/widgets/WmsMaterialContainer/Views/Pages/WmsMaterialContainer/WmsMaterialContainer.tsx index 46b3313..1888740 100644 --- a/HIAWms/hiawms_web/src/widgets/WmsMaterialContainer/Views/Pages/WmsMaterialContainer/WmsMaterialContainer.tsx +++ b/HIAWms/hiawms_web/src/widgets/WmsMaterialContainer/Views/Pages/WmsMaterialContainer/WmsMaterialContainer.tsx @@ -163,7 +163,7 @@ [styles.wmsMaterialContainerList]: true, }} > - <BaseTable + {/* <BaseTable ref={tableRef} url={url} sortUrlTpl="/api/v1/HIAWms/wmsMaterialContainer/{id}/adjustsort/{sort}" @@ -195,7 +195,33 @@ ) }, }} - ></BaseTable> + ></BaseTable> */} + <ElForm> + <ElFormItem label="鐗╂枡鐮�"> + <ElInput + v-model={queryForm.value.searchVal} + placeholder="璇疯緭鍏�" + clearable + class={styles.formItem} + /> + </ElFormItem> + <ElFormItem label="搴撲綅鍙�"> + <ElInput + v-model={queryForm.value.searchVal} + placeholder="璇疯緭鍏�" + clearable + class={styles.formItem} + /> + </ElFormItem> + <ElFormItem label="鏁伴噺"> + <ElInput + v-model={queryForm.value.searchVal} + placeholder="璇疯緭鍏�" + clearable + class={styles.formItem} + /> + </ElFormItem> + </ElForm> </div> ) } @@ -203,16 +229,26 @@ return () => { return ( <div class={styles.wmsMaterialContainerContent}> + <ElForm> + <ElFormItem label="鍏抽敭瀛�"> + <ElInput + v-model={queryForm.value.searchVal} + placeholder="璇疯緭鍏�" + clearable + class={styles.formItem} + /> + </ElFormItem> + </ElForm> {/* 娣诲姞/缂栬緫 */} - <WmsMaterialContainerDrawer + {/* <WmsMaterialContainerDrawer v-model={dialogConfig.visible} title={dialogConfig.title} row={current.value} sort={sort.value} onConfirm={onConfirmWmsMaterialContainer} - /> + /> */} {/* 楂樼骇鏌ヨ */} - <WmsMaterialContainerQueryDrawer + {/* <WmsMaterialContainerQueryDrawer ref="wmsMaterialContainerQueryDrawerRef" v-model={dialogConfigForQuery.visible} title={dialogConfigForQuery.title} @@ -221,9 +257,9 @@ onConfirmQuery={handleQuery} onRestQuery={resetQuery} onClose={closeQuery} - /> + /> */} - <div class={styles.headerContent}> + {/* <div class={styles.headerContent}> <div class={styles.header}> <IconButton v-permission="wmsMaterialContainer-add" @@ -236,7 +272,7 @@ <el-divider direction="vertical" /> <el-divider direction="vertical" /> - {/* <el-upload + <el-upload v-permission="wmsMaterialContainer-import" name="file" accept=".xlsx,.xls,.csv" @@ -256,7 +292,7 @@ onClick={handleExport} > 瀵煎嚭 - </IconButton> */} + </IconButton> </div> <ElFormItem style={{ marginTop: '15px' }}> <ElFormItem label="鍏抽敭瀛�"> @@ -274,9 +310,7 @@ > 鏌ヨ </IconButton> - {/* <IconButton style="" icon="refresh" onClick={resetQuery}> - 閲嶇疆 - </IconButton> */} + <IconButton v-permission="wmsMaterialContainer-add" icon="search" @@ -293,7 +327,7 @@ dataSource={dataSource} isChecked={true} isDrag={true} - /> + /> */} </div> ) } diff --git a/HIAWms/hiawms_web/src/widgets/WmsMaterialStock/Controllers/WmsMaterialStockDrawer.tsx b/HIAWms/hiawms_web/src/widgets/WmsMaterialStock/Controllers/WmsMaterialStockDrawer.tsx index 9371f4c..4e33776 100644 --- a/HIAWms/hiawms_web/src/widgets/WmsMaterialStock/Controllers/WmsMaterialStockDrawer.tsx +++ b/HIAWms/hiawms_web/src/widgets/WmsMaterialStock/Controllers/WmsMaterialStockDrawer.tsx @@ -82,10 +82,6 @@ prop: 'materialName', el: 'input', placeholder: '璇疯緭鍏ョ墿鏂欏悕绉�', - rules: [ - { required: true, message: '鐗╂枡鍚嶇О涓嶈兘涓虹┖', trigger: 'blur' }, - { max: 100, message: '闀垮害涓嶈兘瓒呰繃100涓瓧绗�', trigger: 'blur' }, - ], }, // 瀹瑰櫒淇℃伅 { @@ -324,6 +320,7 @@ formData.value = { isLock: 0, emptyContainer: 0, + checkStatus: 2, inStockTime: new Date(), } updateCheckData() diff --git a/HIAWms/hiawms_web/src/widgets/WmsTask/Controllers/WmsTaskQueryDrawer.tsx b/HIAWms/hiawms_web/src/widgets/WmsTask/Controllers/WmsTaskQueryDrawer.tsx index 77ad7b4..033f41a 100644 --- a/HIAWms/hiawms_web/src/widgets/WmsTask/Controllers/WmsTaskQueryDrawer.tsx +++ b/HIAWms/hiawms_web/src/widgets/WmsTask/Controllers/WmsTaskQueryDrawer.tsx @@ -226,7 +226,7 @@ placeholder: '璇疯緭鍏ユ潵婧愬崟鎹彿', }, { - label: '涓嬩釜浠诲姟鏄惁鐢熸垚鎴愬姛', + label: '涓嬩釜浠诲姟鏄惁鐢熸垚', prop: 'isNextTask', el: (props: any, { attrs }: SetupContext) => { return h(inputNumber, { diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsInOutStockOrderAppService.cs b/HIAWms/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsInOutStockOrderAppService.cs index 73ae65e..5f71424 100644 --- a/HIAWms/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsInOutStockOrderAppService.cs +++ b/HIAWms/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsInOutStockOrderAppService.cs @@ -1,127 +1,152 @@ -using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsInOutStockOrder; -using CMS.Plugin.HIAWms.Application.Contracts.Services; -using CMS.Plugin.HIAWms.Domain.Shared; -using CmsQueryExtensions; -using CMS.Plugin.HIAWms.Domain.WmsInOutStockOrder; -using CmsQueryExtensions.Extension; -using System.Linq.Expressions; -using Volo.Abp; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Data; -using Volo.Abp.ObjectExtending; -using Volo.Abp.ObjectMapping; - -namespace CMS.Plugin.HIAWms.Application.Implements; - +using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsInOutStockOrder; +using CMS.Plugin.HIAWms.Application.Contracts.Services; +using CMS.Plugin.HIAWms.Domain.Shared; +using CmsQueryExtensions; +using CMS.Plugin.HIAWms.Domain.WmsInOutStockOrder; +using CmsQueryExtensions.Extension; +using System.Linq.Expressions; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Data; +using Volo.Abp.ObjectExtending; +using Volo.Abp.ObjectMapping; +using CMS.Plugin.HIAWms.Domain.WmsMaterials; + +namespace CMS.Plugin.HIAWms.Application.Implements; + /// <summary> /// 鍑哄叆搴撳崟鎹簲鐢ㄦ湇鍔� /// </summary> -public class WmsInOutStockOrderAppService : CMSPluginAppService, IWmsInOutStockOrderAppService -{ - private readonly IWmsInOutStockOrderRepository wmsInOutStockOrderRepository; - +public class WmsInOutStockOrderAppService : CMSPluginAppService, IWmsInOutStockOrderAppService +{ + private readonly IWmsInOutStockOrderRepository wmsInOutStockOrderRepository; + private readonly IWmsMaterialRepository _wmsMaterialRepository; + /// <summary> /// Initializes a new instance of the <see cref="WmsInOutStockOrderAppService"/> class. /// </summary> /// <param name="WmsInOutStockOrderRepository">The task job repository.</param> - public WmsInOutStockOrderAppService(IWmsInOutStockOrderRepository _WmsInOutStockOrderRepository) - { - wmsInOutStockOrderRepository = _WmsInOutStockOrderRepository; - } - + public WmsInOutStockOrderAppService(IWmsInOutStockOrderRepository _WmsInOutStockOrderRepository, IWmsMaterialRepository wmsMaterialRepository) + { + wmsInOutStockOrderRepository = _WmsInOutStockOrderRepository; + _wmsMaterialRepository = wmsMaterialRepository; + } + /// <summary> /// 鑾峰彇鎸囧畾鍑哄叆搴撳崟鎹� /// </summary> /// <param name="id"></param> /// <returns></returns> - public virtual async Task<WmsInOutStockOrderDto> GetAsync(Guid id) - { - return ObjectMapper.Map<WmsInOutStockOrder, WmsInOutStockOrderDto>(await wmsInOutStockOrderRepository.GetAsync(id)); - } - + public virtual async Task<WmsInOutStockOrderDto> GetAsync(Guid id) + { + return ObjectMapper.Map<WmsInOutStockOrder, WmsInOutStockOrderDto>(await wmsInOutStockOrderRepository.GetAsync(id)); + } + /// <summary> /// 鍒嗛〉鑾峰彇鍑哄叆搴撳崟鎹� /// </summary> /// <param name="input"></param> /// <returns></returns> - public virtual async Task<PagedResultDto<WmsInOutStockOrderDto>> GetListAsync(GetWmsInOutStockOrderInput input) - { - Check.NotNull(input, nameof(input)); - - if (input.Sorting.IsNullOrWhiteSpace()) - { - input.Sorting = nameof(WmsInOutStockOrder.Sort); - } - + public virtual async Task<PagedResultDto<WmsInOutStockOrderDto>> GetListAsync(GetWmsInOutStockOrderInput input) + { + Check.NotNull(input, nameof(input)); + + if (input.Sorting.IsNullOrWhiteSpace()) + { + input.Sorting = nameof(WmsInOutStockOrder.Sort); + } + #region 鍔ㄦ�佹瀯閫犳煡璇㈡潯浠� - + //鍔ㄦ�佹瀯閫犳煡璇㈡潯浠� - var whereConditions = DynamicGetQueryParams(input); - - #endregion - - var count = await wmsInOutStockOrderRepository.GetCountAsync(whereConditions); - var list = await wmsInOutStockOrderRepository.GetListAsync(whereConditions, input.Sorting, input.MaxResultCount, input.SkipCount); - - return new PagedResultDto<WmsInOutStockOrderDto>(count, ObjectMapper.Map<List<WmsInOutStockOrder>, List<WmsInOutStockOrderDto>>(list)); - } - + var whereConditions = DynamicGetQueryParams(input); + + #endregion + + var count = await wmsInOutStockOrderRepository.GetCountAsync(whereConditions); + var list = await wmsInOutStockOrderRepository.GetListAsync(whereConditions, input.Sorting, input.MaxResultCount, input.SkipCount); + + return new PagedResultDto<WmsInOutStockOrderDto>(count, ObjectMapper.Map<List<WmsInOutStockOrder>, List<WmsInOutStockOrderDto>>(list)); + } + /// <summary> /// 鍔ㄦ�佹瀯閫犳煡璇㈡潯浠� /// </summary> /// <param name="input">杈撳叆鍙傛暟</param> /// <returns></returns> - private FunReturnResultModel<Expression<Func<WmsInOutStockOrder, bool>>> DynamicGetQueryParams(GetWmsInOutStockOrderInput input) - { + private FunReturnResultModel<Expression<Func<WmsInOutStockOrder, bool>>> DynamicGetQueryParams(GetWmsInOutStockOrderInput input) + { //鍔ㄦ�佹瀯閫犳煡璇㈡潯浠� - var whereConditions = WhereConditionsExtensions.GetWhereConditions<WmsInOutStockOrder, GetWmsInOutStockOrderInput>(input); - if (!whereConditions.IsSuccess) - { - throw new Exception("鍔ㄦ�佹瀯閫犳煡璇㈡潯浠跺け璐�:" + whereConditions.ErrMsg); - } - + var whereConditions = WhereConditionsExtensions.GetWhereConditions<WmsInOutStockOrder, GetWmsInOutStockOrderInput>(input); + if (!whereConditions.IsSuccess) + { + throw new Exception("鍔ㄦ�佹瀯閫犳煡璇㈡潯浠跺け璐�:" + whereConditions.ErrMsg); + } + //涔熷彲鍐嶆鑷畾涔夋瀯寤烘煡璇㈡潯浠� - Expression<Func<WmsInOutStockOrder, bool>> extendExpression = a => a.IsDeleted == false; + Expression<Func<WmsInOutStockOrder, bool>> extendExpression = a => a.IsDeleted == false; // 浣跨敤 System.Linq.PredicateBuilder 鐨� And - var pres = (System.Linq.Expressions.Expression<Func<WmsInOutStockOrder, bool>>)(whereConditions.data); - whereConditions.data = System.Linq.PredicateBuilder.And(pres, extendExpression); - - return whereConditions; - } - + var pres = (System.Linq.Expressions.Expression<Func<WmsInOutStockOrder, bool>>)(whereConditions.data); + whereConditions.data = System.Linq.PredicateBuilder.And(pres, extendExpression); + + return whereConditions; + } + /// <summary> /// 鏂板缓鍑哄叆搴撳崟鎹� /// </summary> /// <param name="input"></param> /// <returns></returns> /// <exception cref="UserFriendlyException"></exception> - public virtual async Task<WmsInOutStockOrderDto> CreateAsync(WmsInOutStockOrderCreateDto input) - { - await CheckCreateOrUpdateDtoAsync(input); - - var exist = await wmsInOutStockOrderRepository.NameExistAsync(input.OrderNo); - if (exist) - { - throw new UserFriendlyException(L[CMSPluginDomainErrorCodes.NameAlreadyExists, input.OrderNo]); - } - - var maxSort = await wmsInOutStockOrderRepository.GetMaxSortAsync(); - var sort = input.Sort ?? maxSort; - - var insertObj = ObjectMapper.Map<WmsInOutStockOrderCreateDto, WmsInOutStockOrder>(input); - insertObj.Sort = sort; - input.MapExtraPropertiesTo(insertObj, MappingPropertyDefinitionChecks.None); - - await wmsInOutStockOrderRepository.InsertAsync(insertObj); - + public virtual async Task<WmsInOutStockOrderDto> CreateAsync(WmsInOutStockOrderCreateDto input) + { + await CheckCreateOrUpdateDtoAsync(input); + + var material = await _wmsMaterialRepository.FindByNameAsync(input.MaterialNo); + if (material == null) + { + throw new UserFriendlyException("鐗╂枡淇℃伅涓嶅瓨鍦�"); + } + + var exist = await wmsInOutStockOrderRepository.NameExistAsync(input.OrderNo); + if (exist) + { + throw new UserFriendlyException(L[CMSPluginDomainErrorCodes.NameAlreadyExists, input.OrderNo]); + } + + var maxSort = await wmsInOutStockOrderRepository.GetMaxSortAsync(); + var sort = input.Sort ?? maxSort; + + var maxPriority = await wmsInOutStockOrderRepository.GetMaxPriorityAsync(); + var priority = input.Priority > 0 ? input.Priority : maxPriority; + + var insertObj = ObjectMapper.Map<WmsInOutStockOrderCreateDto, WmsInOutStockOrder>(input); + insertObj.MaterialName = material.MaterialName; + insertObj.MaterialModel = material.MaterialModel; + insertObj.OrderStatus = Domain.Shared.Enums.OrderStatusEnum.NoStart; + + var type = "RK-"; + insertObj.StockType = Domain.Shared.Enums.StockTypeEnum.InBound; + if (input.OrderType == Domain.Shared.Enums.OrderTypeEnum.PRODUCTCALL || input.OrderType == Domain.Shared.Enums.OrderTypeEnum.PERSONOT) + { + type = "CK-"; + insertObj.StockType = Domain.Shared.Enums.StockTypeEnum.OutBound; + } + insertObj.OrderNo = type + DateTime.Now.ToString("yyyyMMddHHmmssfff"); + insertObj.Sort = sort; + insertObj.Priority = priority; + input.MapExtraPropertiesTo(insertObj, MappingPropertyDefinitionChecks.None); + + await wmsInOutStockOrderRepository.InsertAsync(insertObj); + //if (input.Sort.HasValue && insertObj.Sort != maxSort) //{ // await AdjustSortAsync(insertObj.Id, insertObj.Sort); //} - - return ObjectMapper.Map<WmsInOutStockOrder, WmsInOutStockOrderDto>(insertObj); - } - + + return ObjectMapper.Map<WmsInOutStockOrder, WmsInOutStockOrderDto>(insertObj); + } + /// <summary> /// 鏇存柊鍑哄叆搴撳崟鎹� /// </summary> @@ -129,21 +154,21 @@ /// <param name="input"></param> /// <returns></returns> /// <exception cref="UserFriendlyException"></exception> - public virtual async Task<WmsInOutStockOrderDto> UpdateAsync(Guid id, WmsInOutStockOrderUpdateDto input) - { - await CheckCreateOrUpdateDtoAsync(input); - - var updateObj = await wmsInOutStockOrderRepository.GetAsync(id); - var exist = await wmsInOutStockOrderRepository.NameExistAsync(input.OrderNo, updateObj.Id); - if (exist) - { - throw new UserFriendlyException(L[CMSPluginDomainErrorCodes.NameAlreadyExists, input.OrderNo]); - } - - updateObj.SetConcurrencyStampIfNotNull(input.ConcurrencyStamp); - input.MapExtraPropertiesTo(updateObj, MappingPropertyDefinitionChecks.None); - - updateObj.OrderNo = input.OrderNo; + public virtual async Task<WmsInOutStockOrderDto> UpdateAsync(Guid id, WmsInOutStockOrderUpdateDto input) + { + await CheckCreateOrUpdateDtoAsync(input); + + var updateObj = await wmsInOutStockOrderRepository.GetAsync(id); + var exist = await wmsInOutStockOrderRepository.NameExistAsync(input.OrderNo, updateObj.Id); + if (exist) + { + throw new UserFriendlyException(L[CMSPluginDomainErrorCodes.NameAlreadyExists, input.OrderNo]); + } + + updateObj.SetConcurrencyStampIfNotNull(input.ConcurrencyStamp); + input.MapExtraPropertiesTo(updateObj, MappingPropertyDefinitionChecks.None); + + updateObj.OrderNo = input.OrderNo; updateObj.OrderStatus = input.OrderStatus; updateObj.MaterialName = input.MaterialName; updateObj.MaterialNo = input.MaterialNo; @@ -159,20 +184,20 @@ updateObj.OperateTime = input.OperateTime; updateObj.Remark = input.Remark; updateObj.IsDisabled = input.IsDisabled; - - - await wmsInOutStockOrderRepository.UpdateAsync(updateObj); - - return ObjectMapper.Map<WmsInOutStockOrder, WmsInOutStockOrderDto>(updateObj); - } - + + + await wmsInOutStockOrderRepository.UpdateAsync(updateObj); + + return ObjectMapper.Map<WmsInOutStockOrder, WmsInOutStockOrderDto>(updateObj); + } + /// <summary> /// 鍏嬮殕鍑哄叆搴撳崟鎹� /// </summary> /// <param name="ids"></param> /// <returns></returns> - public async Task<List<WmsInOutStockOrderDto>> CloneAsync(IEnumerable<Guid> ids) - { + public async Task<List<WmsInOutStockOrderDto>> CloneAsync(IEnumerable<Guid> ids) + { //var wmsInOutStockOrders = new List<WmsInOutStockOrder>(); //if (ids != null) //{ @@ -192,259 +217,259 @@ // name += WmsInOutStockOrderConsts.CloneTag; // continue; // } - + // notExist = true; // } - + // //WmsInOutStockOrder = await wmsInOutStockOrderRepository.InsertAsync(WmsInOutStockOrder.Clone(GuidGenerator.Create(), name, sort++)); // wmsInOutStockOrders.Add(WmsInOutStockOrder); // } // } //} - + //return ObjectMapper.Map<List<WmsInOutStockOrder>, List<WmsInOutStockOrderDto>>(wmsInOutStockOrders); - return new List<WmsInOutStockOrderDto>(); - } - + return new List<WmsInOutStockOrderDto>(); + } + /// <summary> /// 鍒犻櫎鍗曚釜鍑哄叆搴撳崟鎹� /// </summary> /// <param name="id"></param> /// <returns></returns> - public virtual Task DeleteAsync(Guid id) - { - return wmsInOutStockOrderRepository.DeleteAsync(id); - } - + public virtual async Task DeleteAsync(Guid id) + { + var order = await wmsInOutStockOrderRepository.GetAsync(id); + if(order != null && order.OrderStatus != Domain.Shared.Enums.OrderStatusEnum.NoStart) + { + throw new UserFriendlyException("鍙兘鍒犻櫎鏈紑濮嬬殑鍗曟嵁"); + } + await wmsInOutStockOrderRepository.DeleteAsync(id); + } + /// <summary> /// 鍒犻櫎澶氫釜鍑哄叆搴撳崟鎹� /// </summary> /// <param name="ids"></param> /// <returns></returns> - public async Task DeleteManyAsync(IEnumerable<Guid> ids) - { - foreach (var id in ids) - { - await DeleteAsync(id); - } - } - + public async Task DeleteManyAsync(IEnumerable<Guid> ids) + { + foreach (var id in ids) + { + await DeleteAsync(id); + } + } + /// <summary> /// 璋冩暣鎺掑簭鍑哄叆搴撳崟鎹� /// </summary> /// <param name="id"></param> /// <param name="sort"></param> /// <returns></returns> - public virtual async Task AdjustSortAsync(Guid id, int sort) - { - var list = await wmsInOutStockOrderRepository.GetListAsync(null, nameof(WmsInOutStockOrder.Sort)); - if (list != null && list.Any()) - { - var initSort = 1; - list.ForEach(x => x.AdjustSort(initSort++)); - var entity = list.FirstOrDefault(x => x.Id == id); - if (entity != null) - { - if (sort == 1) - { - list.Where(x => x.Id != id).ToList()?.ForEach(x => x.AdjustSort(x.Sort + 1)); - } - else if (entity.Sort > sort) - { - list.Where(x => x.Id != id && x.Sort >= sort).ToList()?.ForEach(x => x.AdjustSort(x.Sort + 1)); - list.Where(x => x.Id != id && x.Sort < sort).ToList()?.ForEach(x => x.AdjustSort(x.Sort - 1)); - } - else if (entity.Sort < sort) - { - list.Where(x => x.Id != id && x.Sort > sort).ToList()?.ForEach(x => x.AdjustSort(x.Sort + 1)); - list.Where(x => x.Id != id && x.Sort <= sort).ToList()?.ForEach(x => x.AdjustSort(x.Sort - 1)); - } - - entity.AdjustSort(sort); - } - } - - await wmsInOutStockOrderRepository.UpdateManyAsync(list); - } - + public virtual async Task AdjustSortAsync(Guid id, int sort) + { + var list = await wmsInOutStockOrderRepository.GetListAsync(null, nameof(WmsInOutStockOrder.Sort)); + if (list != null && list.Any()) + { + var initSort = 1; + list.ForEach(x => x.AdjustSort(initSort++)); + var entity = list.FirstOrDefault(x => x.Id == id); + if (entity != null) + { + if (sort == 1) + { + list.Where(x => x.Id != id).ToList()?.ForEach(x => x.AdjustSort(x.Sort + 1)); + } + else if (entity.Sort > sort) + { + list.Where(x => x.Id != id && x.Sort >= sort).ToList()?.ForEach(x => x.AdjustSort(x.Sort + 1)); + list.Where(x => x.Id != id && x.Sort < sort).ToList()?.ForEach(x => x.AdjustSort(x.Sort - 1)); + } + else if (entity.Sort < sort) + { + list.Where(x => x.Id != id && x.Sort > sort).ToList()?.ForEach(x => x.AdjustSort(x.Sort + 1)); + list.Where(x => x.Id != id && x.Sort <= sort).ToList()?.ForEach(x => x.AdjustSort(x.Sort - 1)); + } + + entity.AdjustSort(sort); + } + } + + await wmsInOutStockOrderRepository.UpdateManyAsync(list); + } + /// <summary> /// 瀵煎叆鍑哄叆搴撳崟鎹� /// </summary> /// <param name="input"></param> /// <returns></returns> /// <exception cref="UserFriendlyException"></exception> - public async Task ImportAsync(WmsInOutStockOrdersImportModel input) - { - Check.NotNull(input, nameof(input)); - - var wmsInOutStockOrderCreateDtos = new List<(int RowIndex, WmsInOutStockOrderCreateDto Item)>(); - var wmsInOutStockOrderUpdateDtos = new List<(int RowIndex, Guid Id, WmsInOutStockOrderUpdateDto Item)>(); - var importItems = input.WmsInOutStockOrders; - - if (importItems != null && importItems.Any()) - { + public async Task ImportAsync(WmsInOutStockOrdersImportModel input) + { + Check.NotNull(input, nameof(input)); + + var wmsInOutStockOrderCreateDtos = new List<(int RowIndex, WmsInOutStockOrderCreateDto Item)>(); + var wmsInOutStockOrderUpdateDtos = new List<(int RowIndex, Guid Id, WmsInOutStockOrderUpdateDto Item)>(); + var importItems = input.WmsInOutStockOrders; + + if (importItems != null && importItems.Any()) + { #region 瀵煎叆鏍¢獙 - + // 鍒ゆ柇鍚嶇О鏄惁閲嶅锛屽苟杈撳嚭绗嚑琛岄噸澶� - var duplicateWmsInOutStockOrders = importItems.GroupBy(x => x.OrderNo).Where(x => x.Count() > 1).ToList(); - if (duplicateWmsInOutStockOrders?.Any() == true) - { - var duplicateWmsInOutStockOrderMsgs = duplicateWmsInOutStockOrders.Select(x => $"绗� {string.Join(",", x.Select(x => x.RowIndex))} 琛岋細{x.Key} 鍚嶇О閲嶅"); - var errorMsg = $"瀵煎叆澶辫触锛侀厤缃紝 {string.Join(",", duplicateWmsInOutStockOrderMsgs)}锛岀粓姝㈠鍏�"; - throw new UserFriendlyException(errorMsg); - } - - #endregion - - foreach (var impItem in importItems) - { - if (impItem.OrderNo.IsNullOrWhiteSpace()) - { - continue; - } - - if (impItem.OrderNo.IsNullOrWhiteSpace()) - { - var errorMsg = $"瀵煎叆澶辫触锛侀厤缃紝绗瑊impItem.RowIndex}琛岋細WmsInOutStockOrder鍚嶇О涓嶈兘涓虹┖"; - throw new UserFriendlyException(errorMsg); - } - - var oldWmsInOutStockOrder = await wmsInOutStockOrderRepository.FindByNameAsync(impItem.OrderNo); - if (oldWmsInOutStockOrder != null) - { - var wmsInOutStockOrderUpdateDto = new WmsInOutStockOrderUpdateDto - { + var duplicateWmsInOutStockOrders = importItems.GroupBy(x => x.OrderNo).Where(x => x.Count() > 1).ToList(); + if (duplicateWmsInOutStockOrders?.Any() == true) + { + var duplicateWmsInOutStockOrderMsgs = duplicateWmsInOutStockOrders.Select(x => $"绗� {string.Join(",", x.Select(x => x.RowIndex))} 琛岋細{x.Key} 鍚嶇О閲嶅"); + var errorMsg = $"瀵煎叆澶辫触锛侀厤缃紝 {string.Join(",", duplicateWmsInOutStockOrderMsgs)}锛岀粓姝㈠鍏�"; + throw new UserFriendlyException(errorMsg); + } + + #endregion + + foreach (var impItem in importItems) + { + if (impItem.OrderNo.IsNullOrWhiteSpace()) + { + continue; + } + + if (impItem.OrderNo.IsNullOrWhiteSpace()) + { + var errorMsg = $"瀵煎叆澶辫触锛侀厤缃紝绗瑊impItem.RowIndex}琛岋細WmsInOutStockOrder鍚嶇О涓嶈兘涓虹┖"; + throw new UserFriendlyException(errorMsg); + } + + var oldWmsInOutStockOrder = await wmsInOutStockOrderRepository.FindByNameAsync(impItem.OrderNo); + if (oldWmsInOutStockOrder != null) + { + var wmsInOutStockOrderUpdateDto = new WmsInOutStockOrderUpdateDto + { OrderNo = impItem.OrderNo, -OrderStatus = impItem.OrderStatus, -MaterialName = impItem.MaterialName, -MaterialNo = impItem.MaterialNo, -MaterialModel = impItem.MaterialModel, -MaterialBatch = impItem.MaterialBatch, -OrderType = impItem.OrderType, -StockType = impItem.StockType, -MaterialNumber = impItem.MaterialNumber, -DistributeNumber = impItem.DistributeNumber, -CompleteNumber = impItem.CompleteNumber, -Priority = impItem.Priority, -PlanNo = impItem.PlanNo, -OperateTime = impItem.OperateTime, -Remark = impItem.Remark, -IsDisabled = impItem.IsDisabled, - - }; - - wmsInOutStockOrderUpdateDtos.Add((impItem.RowIndex, oldWmsInOutStockOrder.Id, wmsInOutStockOrderUpdateDto)); - } - else - { - var wmsInOutStockOrderCreateDto = new WmsInOutStockOrderCreateDto - { + OrderStatus = impItem.OrderStatus, + MaterialName = impItem.MaterialName, + MaterialNo = impItem.MaterialNo, + MaterialModel = impItem.MaterialModel, + MaterialBatch = impItem.MaterialBatch, + OrderType = impItem.OrderType, + StockType = impItem.StockType, + MaterialNumber = impItem.MaterialNumber, + DistributeNumber = impItem.DistributeNumber, + CompleteNumber = impItem.CompleteNumber, + Priority = impItem.Priority, + PlanNo = impItem.PlanNo, + OperateTime = impItem.OperateTime, + Remark = impItem.Remark, + IsDisabled = impItem.IsDisabled, + + }; + + wmsInOutStockOrderUpdateDtos.Add((impItem.RowIndex, oldWmsInOutStockOrder.Id, wmsInOutStockOrderUpdateDto)); + } + else + { + var wmsInOutStockOrderCreateDto = new WmsInOutStockOrderCreateDto + { OrderNo = impItem.OrderNo, -OrderStatus = impItem.OrderStatus, -MaterialName = impItem.MaterialName, -MaterialNo = impItem.MaterialNo, -MaterialModel = impItem.MaterialModel, -MaterialBatch = impItem.MaterialBatch, -OrderType = impItem.OrderType, -StockType = impItem.StockType, -MaterialNumber = impItem.MaterialNumber, -DistributeNumber = impItem.DistributeNumber, -CompleteNumber = impItem.CompleteNumber, -Priority = impItem.Priority, -PlanNo = impItem.PlanNo, -OperateTime = impItem.OperateTime, -Remark = impItem.Remark, -IsDisabled = impItem.IsDisabled, - - }; - - wmsInOutStockOrderCreateDtos.Add((impItem.RowIndex, wmsInOutStockOrderCreateDto)); - } - } - } - + OrderStatus = impItem.OrderStatus, + MaterialName = impItem.MaterialName, + MaterialNo = impItem.MaterialNo, + MaterialModel = impItem.MaterialModel, + MaterialBatch = impItem.MaterialBatch, + OrderType = impItem.OrderType, + StockType = impItem.StockType, + MaterialNumber = impItem.MaterialNumber, + DistributeNumber = impItem.DistributeNumber, + CompleteNumber = impItem.CompleteNumber, + Priority = impItem.Priority, + PlanNo = impItem.PlanNo, + OperateTime = impItem.OperateTime, + Remark = impItem.Remark, + IsDisabled = impItem.IsDisabled, + + }; + + wmsInOutStockOrderCreateDtos.Add((impItem.RowIndex, wmsInOutStockOrderCreateDto)); + } + } + } + // 鏂板 - foreach (var wmsInOutStockOrderDto in wmsInOutStockOrderCreateDtos) - { - try - { - await CreateAsync(wmsInOutStockOrderDto.Item); - } - catch (Exception e) - { - var errorMsg = $"瀵煎叆澶辫触锛侀厤缃紝绗瑊wmsInOutStockOrderDto.RowIndex}琛岋細{e.Message}锛岀粓姝㈠鍏�"; - throw new UserFriendlyException(errorMsg); - } - } - + foreach (var wmsInOutStockOrderDto in wmsInOutStockOrderCreateDtos) + { + try + { + await CreateAsync(wmsInOutStockOrderDto.Item); + } + catch (Exception e) + { + var errorMsg = $"瀵煎叆澶辫触锛侀厤缃紝绗瑊wmsInOutStockOrderDto.RowIndex}琛岋細{e.Message}锛岀粓姝㈠鍏�"; + throw new UserFriendlyException(errorMsg); + } + } + // 鏇存柊 - foreach (var wmsInOutStockOrderDto in wmsInOutStockOrderUpdateDtos) - { - try - { - await UpdateAsync(wmsInOutStockOrderDto.Id, wmsInOutStockOrderDto.Item); - } - catch (Exception e) - { - var errorMsg = $"瀵煎叆澶辫触锛侀厤缃紝绗瑊wmsInOutStockOrderDto.RowIndex}琛岋細{e.Message}锛岀粓姝㈠鍏�"; - throw new UserFriendlyException(errorMsg); - } - } - } - + foreach (var wmsInOutStockOrderDto in wmsInOutStockOrderUpdateDtos) + { + try + { + await UpdateAsync(wmsInOutStockOrderDto.Id, wmsInOutStockOrderDto.Item); + } + catch (Exception e) + { + var errorMsg = $"瀵煎叆澶辫触锛侀厤缃紝绗瑊wmsInOutStockOrderDto.RowIndex}琛岋細{e.Message}锛岀粓姝㈠鍏�"; + throw new UserFriendlyException(errorMsg); + } + } + } + /// <summary> /// 瀵煎嚭鍑哄叆搴撳崟鎹� /// </summary> /// <param name="input"></param> /// <returns></returns> - public async Task<(Dictionary<string, object> Sheets, string FileName)> ExportAsync(GetWmsInOutStockOrderInput input) - { - Check.NotNull(input, nameof(input)); - - if (input.Sorting.IsNullOrWhiteSpace()) - { - input.Sorting = nameof(WmsInOutStockOrder.Sort); - } - + public async Task<(Dictionary<string, object> Sheets, string FileName)> ExportAsync(GetWmsInOutStockOrderInput input) + { + Check.NotNull(input, nameof(input)); + + if (input.Sorting.IsNullOrWhiteSpace()) + { + input.Sorting = nameof(WmsInOutStockOrder.Sort); + } + #region 鍔ㄦ�佹瀯閫犳煡璇㈡潯浠� - + //鍔ㄦ�佹瀯閫犳煡璇㈡潯浠� - var whereConditions = DynamicGetQueryParams(input); - - #endregion - - - var list = await wmsInOutStockOrderRepository.GetListAsync(whereConditions, input.Sorting, input.MaxResultCount, input.SkipCount, includeDetails: true); - var result = ObjectMapper.Map<List<WmsInOutStockOrder>, List<WmsInOutStockOrderDto>>(list); - - var sheets = new Dictionary<string, object> - { - ["閰嶇疆"] = ExportHelper.ConvertListToExportData(result), - }; - - var fileName = result.Count > 1 ? "鍑哄叆搴撳崟鎹垪琛�" : result.Count == 1 ? result[0]?.OrderNo : "WmsInOutStockOrder妯$増"; - return (sheets, fileName); - } - + var whereConditions = DynamicGetQueryParams(input); + + #endregion + + + var list = await wmsInOutStockOrderRepository.GetListAsync(whereConditions, input.Sorting, input.MaxResultCount, input.SkipCount, includeDetails: true); + var result = ObjectMapper.Map<List<WmsInOutStockOrder>, List<WmsInOutStockOrderDto>>(list); + + var sheets = new Dictionary<string, object> + { + ["閰嶇疆"] = ExportHelper.ConvertListToExportData(result), + }; + + var fileName = result.Count > 1 ? "鍑哄叆搴撳崟鎹垪琛�" : result.Count == 1 ? result[0]?.OrderNo : "WmsInOutStockOrder妯$増"; + return (sheets, fileName); + } + /// <summary> /// 鏍¢獙鍑哄叆搴撳崟鎹紝褰撴柊寤烘垨鏇存柊鏃� /// </summary> /// <param name="input"></param> /// <returns></returns> - protected Task CheckCreateOrUpdateDtoAsync(WmsInOutStockOrderCreateOrUpdateDtoBase input) - { - Check.NotNull(input, nameof(input)); - Check.NotNullOrWhiteSpace(input.OrderNo, "鍗曟嵁缂栧彿", 50); - Check.NotNull(input.OrderStatus, "鍗曟嵁鐘舵��"); - Check.NotNullOrWhiteSpace(input.MaterialNo, "鐗╂枡浠跺彿", 50); + protected Task CheckCreateOrUpdateDtoAsync(WmsInOutStockOrderCreateOrUpdateDtoBase input) + { + Check.NotNull(input, nameof(input)); + Check.NotNullOrWhiteSpace(input.MaterialNo, "鐗╂枡缂栧彿", 50); Check.NotNullOrWhiteSpace(input.MaterialBatch, "鎵规鍙�", 50); Check.NotNull(input.OrderType, "鍗曟嵁绫诲瀷"); - Check.NotNull(input.StockType, "鎿嶄綔绫诲瀷锛堟灇涓惧�硷級"); + Check.NotNull(input.StockType, "鎿嶄綔绫诲瀷"); Check.NotNull(input.MaterialNumber, "鍗曟嵁鏁伴噺"); - Check.NotNull(input.DistributeNumber, "涓嬪彂鏁伴噺"); - Check.NotNull(input.CompleteNumber, "瀹屾垚鏁伴噺"); - Check.NotNull(input.Priority, "浼樺厛绾�"); - - return Task.CompletedTask; - } -} + + return Task.CompletedTask; + } +} diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsMaterialStockAppService.cs b/HIAWms/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsMaterialStockAppService.cs index 98eb755..a03b0b0 100644 --- a/HIAWms/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsMaterialStockAppService.cs +++ b/HIAWms/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsMaterialStockAppService.cs @@ -104,6 +104,15 @@ { throw new UserFriendlyException("搴撲綅搴撳尯淇℃伅涓嶅瓨鍦�"); } + var wmsmaterialstockList = await _wmsmaterialstockRepository.GetStockListAsync(new WmsMaterialStock { PlaceNo = input.PlaceNo }); + if (wmsmaterialstockList.Count > 0) + { + if (wmsmaterialstockList[0].MaterialNo != input.MaterialNo) + { + throw new UserFriendlyException("褰撳墠搴撲綅宸插瓨鏀惧埆鐨勭墿鏂�"); + } + } + var maxSort = await _wmsmaterialstockRepository.GetMaxSortAsync(); var sort = input.Sort ?? maxSort; var wmsmaterialstock = ObjectMapper.Map<WmsMaterialStockCreateDto, WmsMaterialStock>(input); @@ -133,7 +142,7 @@ stock = JsonSerializer.Deserialize<WmsMaterialStock>(json); stock.MaterialId = Guid.NewGuid().ToString("N"); stock.StockNumber = 1; - stockList.Add(stock); + stockList.Add(stock); } await _wmsmaterialstockRepository.InsertManyAsync(stockList); @@ -146,10 +155,10 @@ await _wmscontainerRepository.UpdateAsync(container); await _wmsplaceRepository.UpdateAsync(place); - if (input.Sort.HasValue && wmsmaterialstock.Sort != maxSort) - { - await AdjustSortAsync(wmsmaterialstock.Id, wmsmaterialstock.Sort); - } + //if (input.Sort.HasValue && wmsmaterialstock.Sort != maxSort) + //{ + // await AdjustSortAsync(wmsmaterialstock.Id, wmsmaterialstock.Sort); + //} await uow.SaveChangesAsync(); await uow.CompleteAsync(); return ObjectMapper.Map<WmsMaterialStock, WmsMaterialStockDto>(wmsmaterialstock); diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms.Domain/WmsInOutStockOrder/IWmsInOutStockOrderRepository.cs b/HIAWms/server/src/CMS.Plugin.HIAWms.Domain/WmsInOutStockOrder/IWmsInOutStockOrderRepository.cs index 22f5cc3..57b3c9b 100644 --- a/HIAWms/server/src/CMS.Plugin.HIAWms.Domain/WmsInOutStockOrder/IWmsInOutStockOrderRepository.cs +++ b/HIAWms/server/src/CMS.Plugin.HIAWms.Domain/WmsInOutStockOrder/IWmsInOutStockOrderRepository.cs @@ -29,8 +29,14 @@ /// 鑾峰彇鏈�澶ф帓搴忓嚭鍏ュ簱鍗曟嵁 /// </summary> /// <returns></returns> - Task<int> GetMaxSortAsync(); - + Task<int> GetMaxSortAsync(); + + /// <summary> + /// 鑾峰彇鏈�澶т紭鍏堢骇鍊� + /// </summary> + /// <returns></returns> + Task<int> GetMaxPriorityAsync(); + /// <summary> /// 鑾峰彇鍒嗛〉鍒楄〃鍑哄叆搴撳崟鎹� /// </summary> diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms.EntityFrameworkCore/Repositories/EfCoreWmsInOutStockOrderRepository.cs b/HIAWms/server/src/CMS.Plugin.HIAWms.EntityFrameworkCore/Repositories/EfCoreWmsInOutStockOrderRepository.cs index 30f58f9..2a3f7aa 100644 --- a/HIAWms/server/src/CMS.Plugin.HIAWms.EntityFrameworkCore/Repositories/EfCoreWmsInOutStockOrderRepository.cs +++ b/HIAWms/server/src/CMS.Plugin.HIAWms.EntityFrameworkCore/Repositories/EfCoreWmsInOutStockOrderRepository.cs @@ -66,8 +66,33 @@ var sort = await (await GetQueryableAsync()) .Where(x => !x.IsDeleted).MaxAsync(x => x.Sort); return sort + 1; - } - + } + + /// <summary> + /// 鑾峰彇鏈�澶т紭鍏堢骇鍊� + /// </summary> + /// <returns></returns> + public async Task<int> GetMaxPriorityAsync() + { + // 鑾峰彇浠婂ぉ鐨勬棩鏈燂紙鏃堕棿閮ㄥ垎涓�00:00:00锛� + var today = DateTime.Today; + + var queryable = await GetQueryableAsync(); + var query = queryable + .Where(x => x.CreationTime > today) + .Where(x => !x.IsDeleted); + + var hasAny = await query.AnyAsync(); + if (!hasAny) + { + return 1; + } + + // 鑾峰彇鏈�澶ort鍊煎苟鍔�1 + var maxSort = await query.MaxAsync(x => x.Sort); + return maxSort + 1; + } + /// <summary> /// 鑾峰彇鍒嗛〉鍒楄〃鍑哄叆搴撳崟鎹� /// </summary> -- Gitblit v1.9.3