From 0ea40a1592de878592b2872b9c3005014233a136 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期一, 08 十二月 2025 21:24:11 +0800
Subject: [PATCH] 提交
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs | 135 +++++++++++++---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs | 4
项目代码/WIDESEA_WMSClient/src/extension/inbound/allocateinboundOrder.js | 22 ++
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs | 2
项目代码/WIDESEA_WMSClient/src/views/stock/stockInfoDetail.vue | 1
项目代码/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js | 271 ++++++++++++++++++---------------
6 files changed, 275 insertions(+), 160 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/allocateinboundOrder.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/allocateinboundOrder.js"
index 38f5145..ca0f429 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/allocateinboundOrder.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/allocateinboundOrder.js"
@@ -54,7 +54,8 @@
// 鍝嶅簲寮忚〃鍗曟暟鎹細鎵樼洏鍙凤紙蹇呭~锛�
const formData = reactive({
- palletCode: '' // 鎵樼洏鍙疯緭鍏ユ
+ palletCode: '', // 鎵樼洏鍙疯緭鍏ユ
+ barcode:''
});
// 鎻愪氦琛ㄥ崟鐨勭粺涓�閫昏緫
@@ -71,7 +72,7 @@
// 鍙戣捣鎾ら攢缁勭洏璇锋眰
try {
//console.log('鍙戣捣鎾ら攢缁勭洏璇锋眰锛屾墭鐩樺彿锛�', formData.palletCode.trim());
- const response = await http.post('/api/InboundOrder/UndoPalletGroup?palletCode='+formData.palletCode.trim());
+ const response = await http.post('/api/InboundOrder/UndoPalletGroup?palletCode='+formData.palletCode.trim()+'&barcode='+formData.barcode.trim());
const { status, message, data } = response;
@@ -155,6 +156,23 @@
}
})
]),
+ h(ElFormItem,{label: '鏉$爜', prop: 'barcode'},[
+ h(ElInput, {
+ type: 'text',
+ modelValue: formData.barcode,
+ 'onUpdate:modelValue': (val) => {
+ formData.barcode = val;
+ },
+ placeholder: '鍙�夛紝鎵爜杈撳叆鎴栨墜鍔ㄨ緭鍏ユ潯鐮�',
+ maxLength: 50,
+ onKeydown: (e) => {
+ if (e.key === 'Enter') {
+ e.preventDefault();
+ submitForm();
+ }
+ }
+ })
+ ]),
// 搴曢儴鎸夐挳鍖�
h('div', { style: { textAlign: 'right', marginTop: '16px' } }, [
h(ElButton, {
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js"
index 328cdbf..cf21535 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js"
@@ -44,140 +44,159 @@
this.$emit('openPalletDialog', targetRow.inboundOrderNo);
}
},
- {
- name: '鎾ら攢缁勭洏',
- type: 'primary',
- value: '鎾ら攢缁勭洏',
- onClick: function () {
- console.log('鎾ら攢缁勭洏鎸夐挳琚偣鍑�');
- const mountNode = document.createElement('div');
- document.body.appendChild(mountNode);
+ {
+ name: '鎾ら攢缁勭洏',
+ type: 'primary',
+ value: '鎾ら攢缁勭洏',
+ onClick: function () {
+ console.log('鎾ら攢缁勭洏鎸夐挳琚偣鍑�');
+ const mountNode = document.createElement('div');
+ document.body.appendChild(mountNode);
- // 鍝嶅簲寮忚〃鍗曟暟鎹細鎵樼洏鍙凤紙蹇呭~锛�
- const formData = reactive({
- palletCode: '' // 鎵樼洏鍙疯緭鍏ユ
- });
+ // 鍝嶅簲寮忚〃鍗曟暟鎹細鎵樼洏鍙凤紙蹇呭~锛�
+ const formData = reactive({
+ palletCode: '', // 鎵樼洏鍙疯緭鍏ユ
+ barcode:''
+ });
- // 鎻愪氦琛ㄥ崟鐨勭粺涓�閫昏緫
- const submitForm = async () => {
- const formRef = vnode.component.refs.cancelPalletForm;
- try {
- // 鎵ц琛ㄥ崟鏍¢獙锛堟墭鐩樺彿蹇呭~锛�
- await formRef.validate();
- } catch (err) {
- ElMessage.warning('璇疯緭鍏ユ湁鏁堢殑鎵樼洏鍙�');
- return;
- }
+ // 鎻愪氦琛ㄥ崟鐨勭粺涓�閫昏緫
+ const submitForm = async () => {
+ const formRef = vnode.component.refs.cancelPalletForm;
+ try {
+ // 鎵ц琛ㄥ崟鏍¢獙锛堟墭鐩樺彿蹇呭~锛�
+ await formRef.validate();
+ } catch (err) {
+ ElMessage.warning('璇疯緭鍏ユ湁鏁堢殑鎵樼洏鍙�');
+ return;
+ }
- // 鍙戣捣鎾ら攢缁勭洏璇锋眰
- try {
- //console.log('鍙戣捣鎾ら攢缁勭洏璇锋眰锛屾墭鐩樺彿锛�', formData.palletCode.trim());
- const response = await http.post('/api/InboundOrder/UndoPalletGroup?palletCode=' + formData.palletCode.trim());
+ // 鍙戣捣鎾ら攢缁勭洏璇锋眰
+ try {
+ //console.log('鍙戣捣鎾ら攢缁勭洏璇锋眰锛屾墭鐩樺彿锛�', formData.palletCode.trim());
+ const response = await http.post('/api/InboundOrder/UndoPalletGroup?palletCode='+formData.palletCode.trim()+'&barcode='+formData.barcode.trim());
+
+ const { status, message, data } = response;
+ if (status) {
+ ElMessage.success(response.message);
+ console.log(response.message)
+ this.refresh(); // 鎴愬姛鍚庡埛鏂板垪琛�
+ // 鍏抽棴瀵硅瘽妗�
+ render(null, mountNode);
+ document.body.removeChild(mountNode);
+ } else {
+ console.log('鎾ら攢缁勭洏澶辫触锛屽悗绔彁绀猴細', message);
+ ElMessage.error(message || data?.message || '鎾ら攢缁勭洏澶辫触');
+ selectPalletCodeInput(); // 閫変腑杈撳叆妗嗘柟渚块噸鏂拌緭鍏�
+ }
+ } catch (error) {
+ console.error('鎾ら攢缁勭洏璇锋眰寮傚父锛�', error);
+ ElMessage.error('缃戠粶寮傚父鎴栨帴鍙i敊璇紝璇风◢鍚庨噸璇�');
+ selectPalletCodeInput();
+ }
+ };
- const { status, message, data } = response;
- if (status) {
- ElMessage.success(`鎾ら攢缁勭洏鎴愬姛锛屾墭鐩樺彿锛�${formData.palletCode.trim()}`);
- this.refresh(); // 鎴愬姛鍚庡埛鏂板垪琛�
- // 鍏抽棴瀵硅瘽妗�
- render(null, mountNode);
- document.body.removeChild(mountNode);
- } else {
- console.log('鎾ら攢缁勭洏澶辫触锛屽悗绔彁绀猴細', message);
- ElMessage.error(message || data?.message || '鎾ら攢缁勭洏澶辫触');
- selectPalletCodeInput(); // 閫変腑杈撳叆妗嗘柟渚块噸鏂拌緭鍏�
- }
- } catch (error) {
- console.error('鎾ら攢缁勭洏璇锋眰寮傚父锛�', error);
- ElMessage.error('缃戠粶寮傚父鎴栨帴鍙i敊璇紝璇风◢鍚庨噸璇�');
- selectPalletCodeInput();
- }
- };
+ // 閫変腑杈撳叆妗嗘枃鏈紙鏂逛究閲嶆柊杈撳叆锛�
+ const selectPalletCodeInput = () => {
+ setTimeout(() => {
+ const inputRef = vnode.component.refs.palletCodeInput;
+ if (inputRef) {
+ const targetInput = inputRef.$el?.querySelector('input') || inputRef;
+ targetInput?.focus();
+ targetInput?.select();
+ }
+ }, 100);
+ };
- // 閫変腑杈撳叆妗嗘枃鏈紙鏂逛究閲嶆柊杈撳叆锛�
- const selectPalletCodeInput = () => {
- setTimeout(() => {
- const inputRef = vnode.component.refs.palletCodeInput;
- if (inputRef) {
- const targetInput = inputRef.$el?.querySelector('input') || inputRef;
- targetInput?.focus();
- targetInput?.select();
- }
- }, 100);
- };
+ // 鍒涘缓瀵硅瘽妗哣Node
+ const vnode = createVNode(ElDialog, {
+ title: '鎾ら攢缁勭洏',
+ width: '400px',
+ modelValue: true,
+ appendToBody: true,
+ onOpened: () => {
+ // 瀵硅瘽妗嗘墦寮�鍚庤嚜鍔ㄨ仛鐒﹁緭鍏ユ
+ setTimeout(() => {
+ const inputRef = vnode.component.refs.palletCodeInput;
+ inputRef?.focus();
+ }, 100);
+ },
+ 'onUpdate:modelValue': (isVisible) => {
+ if (!isVisible) {
+ render(null, mountNode);
+ document.body.removeChild(mountNode);
+ }
+ }
+ }, {
+ default: () => h(ElForm, {
+ model: formData,
+ rules: {
+ palletCode: [
+ { required: true, message: '璇疯緭鍏ユ墭鐩樺彿', trigger: ['blur', 'enter'] },
+ { min: 1, max: 50, message: '鎵樼洏鍙烽暱搴︿笉鑳借秴杩�50涓瓧绗�', trigger: ['blur', 'input'] }
+ ]
+ },
+ ref: 'cancelPalletForm'
+ }, [
+ // 鎵樼洏鍙疯緭鍏ラ」
+ h(ElFormItem, { label: '鎵樼洏鍙�', prop: 'palletCode', required: true }, [
+ h(ElInput, {
+ type: 'text',
+ modelValue: formData.palletCode,
+ 'onUpdate:modelValue': (val) => {
+ formData.palletCode = val;
+ },
+ ref: 'palletCodeInput',
+ placeholder: '鎵爜杈撳叆鎴栨墜鍔ㄨ緭鍏ユ墭鐩樺彿',
+ maxLength: 50,
+ // 鐩戝惉鍥炶溅浜嬩欢锛堟壂鐮佹灙榛樿浼氬彂閫佸洖杞︼級
+ onKeydown: (e) => {
+ if (e.key === 'Enter') {
+ e.preventDefault();
+ submitForm();
+ }
+ }
+ })
+ ]),
+ h(ElFormItem,{label: '鏉$爜', prop: 'barcode'},[
+ h(ElInput, {
+ type: 'text',
+ modelValue: formData.barcode,
+ 'onUpdate:modelValue': (val) => {
+ formData.barcode = val;
+ },
+ placeholder: '鍙�夛紝鎵爜杈撳叆鎴栨墜鍔ㄨ緭鍏ユ潯鐮�',
+ maxLength: 50,
+ onKeydown: (e) => {
+ if (e.key === 'Enter') {
+ e.preventDefault();
+ submitForm();
+ }
+ }
+ })
+ ]),
+ // 搴曢儴鎸夐挳鍖�
+ h('div', { style: { textAlign: 'right', marginTop: '16px' } }, [
+ h(ElButton, {
+ type: 'text',
+ onClick: () => {
+ render(null, mountNode);
+ document.body.removeChild(mountNode);
+ ElMessage.info('鍙栨秷鎾ら攢缁勭洏');
+ }
+ }, '鍙栨秷'),
+ h(ElButton, {
+ type: 'primary',
+ onClick: submitForm.bind(this) // 缁戝畾this涓婁笅鏂�
+ }, '纭鎾ら攢')
+ ])
+ ])
+ });
- // 鍒涘缓瀵硅瘽妗哣Node
- const vnode = createVNode(ElDialog, {
- title: '鎾ら攢缁勭洏',
- width: '400px',
- modelValue: true,
- appendToBody: true,
- onOpened: () => {
- // 瀵硅瘽妗嗘墦寮�鍚庤嚜鍔ㄨ仛鐒﹁緭鍏ユ
- setTimeout(() => {
- const inputRef = vnode.component.refs.palletCodeInput;
- inputRef?.focus();
- }, 100);
+ vnode.appContext = this.$.appContext;
+ render(vnode, mountNode);
+ }
},
- 'onUpdate:modelValue': (isVisible) => {
- if (!isVisible) {
- render(null, mountNode);
- document.body.removeChild(mountNode);
- }
- }
- }, {
- default: () => h(ElForm, {
- model: formData,
- rules: {
- palletCode: [
- { required: true, message: '璇疯緭鍏ユ墭鐩樺彿', trigger: ['blur', 'enter'] },
- { min: 1, max: 50, message: '鎵樼洏鍙烽暱搴︿笉鑳借秴杩�50涓瓧绗�', trigger: ['blur', 'input'] }
- ]
- },
- ref: 'cancelPalletForm'
- }, [
- // 鎵樼洏鍙疯緭鍏ラ」
- h(ElFormItem, { label: '鎵樼洏鍙�', prop: 'palletCode', required: true }, [
- h(ElInput, {
- type: 'text',
- modelValue: formData.palletCode,
- 'onUpdate:modelValue': (val) => {
- formData.palletCode = val;
- },
- ref: 'palletCodeInput',
- placeholder: '鎵爜杈撳叆鎴栨墜鍔ㄨ緭鍏ユ墭鐩樺彿',
- maxLength: 50,
- // 鐩戝惉鍥炶溅浜嬩欢锛堟壂鐮佹灙榛樿浼氬彂閫佸洖杞︼級
- onKeydown: (e) => {
- if (e.key === 'Enter') {
- e.preventDefault();
- submitForm();
- }
- }
- })
- ]),
- // 搴曢儴鎸夐挳鍖�
- h('div', { style: { textAlign: 'right', marginTop: '16px' } }, [
- h(ElButton, {
- type: 'text',
- onClick: () => {
- render(null, mountNode);
- document.body.removeChild(mountNode);
- ElMessage.info('鍙栨秷鎾ら攢缁勭洏');
- }
- }, '鍙栨秷'),
- h(ElButton, {
- type: 'primary',
- onClick: submitForm.bind(this) // 缁戝畾this涓婁笅鏂�
- }, '纭鎾ら攢')
- ])
- ])
- });
-
- vnode.appContext = this.$.appContext;
- render(vnode, mountNode);
- }
- },
{
name: '鍒嗘壒鍏ュ簱',
type: 'primary',
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockInfoDetail.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockInfoDetail.vue"
index c5f6168..88df97e 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockInfoDetail.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockInfoDetail.vue"
@@ -60,6 +60,7 @@
materielCode: "",
materielName: "",
orderNo: "",
+ palletCode:""
});
const searchFormOptions = ref([
[
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs"
index 6832442..355df9b 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs"
@@ -24,6 +24,6 @@
WebResponseContent UnPalletQuantity(string orderNo);
- WebResponseContent UndoPalletGroup(string palletCode);
+ WebResponseContent UndoPalletGroup(string palletCode , string barcode = "");
}
}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
index 51e758d..72f08a3 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
@@ -646,48 +646,125 @@
}
}
- public WebResponseContent UndoPalletGroup(string palletCode)
+ public WebResponseContent UndoPalletGroup(string palletCode, string barcode = "")
{
+
if (string.IsNullOrWhiteSpace(palletCode))
{
return WebResponseContent.Instance.Error("鎵樼洏鍙蜂笉鑳戒负绌�");
}
- var stock = _stockRepository.Db.Queryable<Dt_StockInfo>().Includes(o => o.Details).First(x => x.PalletCode == palletCode && (x.StockStatus == (int)StockStatusEmun.缁勭洏鏆傚瓨|| x.StockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt()));
- if (stock == null)
- {
- return WebResponseContent.Instance.Error($"鏈壘鍒版墭鐩樺彿{palletCode}瀵瑰簲鐨勫簱瀛樿褰�");
- }
- if (stock.Details == null || !stock.Details.Any())
+
+ try
{
+ _unitOfWorkManage.BeginTran();
+
+ // 2. 鏌ヨ鎵樼洏搴撳瓨涓昏褰曪紙閬垮厤鏃犳暟鎹姏寮傚父锛�
+ var stock = _stockRepository.Db.Queryable<Dt_StockInfo>()
+ .Includes(o => o.Details)
+ .First(x => x.PalletCode == palletCode
+ && (x.StockStatus == (int)StockStatusEmun.缁勭洏鏆傚瓨
+ || x.StockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt()));
+
+ if (stock == null)
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒版墭鐩樺彿{palletCode}瀵瑰簲鐨勫簱瀛樿褰�");
+ }
+
+ // 3. 鍦烘櫙1锛氬垹闄ゆ寚瀹氭潯鐮�
+ if (!string.IsNullOrWhiteSpace(barcode))
+ {
+ var targetDetail = stock.Details?.FirstOrDefault(x => x.Barcode == barcode);
+ if (targetDetail == null)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return WebResponseContent.Instance.Error($"鎵樼洏{palletCode}涓嬫湭鎵惧埌鏉$爜{barcode}鐨勬槑缁嗚褰�");
+ }
+
+ // 鍒犻櫎鎸囧畾鏄庣粏
+ _stockDetailRepository.DeleteData(targetDetail);
+
+ // 閲嶆柊鏌ヨ鍓╀綑鏄庣粏锛堜繚璇佹暟鎹噯纭�э級
+ var remainingDetails = _stockDetailRepository.Db.Queryable<Dt_StockInfoDetail>()
+ .Where(x => x.StockId == stock.Id)
+ .ToList();
+
+ // 鍓╀綑鏄庣粏涓虹┖ 鈫� 鍒犻櫎涓昏〃 + 閲嶇疆鍏ュ簱鍗曞強鏄庣粏鐘舵��
+ if (!remainingDetails.Any())
+ {
+ // 閲嶇疆鍏ュ簱鍗曞強鏄庣粏鐘舵��
+ ResetInboundOrderStatus(stock.Details.Select(d => d.OrderNo).Distinct().ToList());
+
+ _stockRepository.DeleteData(stock);
+ _unitOfWorkManage.CommitTran();
+ return WebResponseContent.Instance.OK($"鏉$爜{barcode}鎾ら攢鎴愬姛锛屾墭鐩樻棤鍓╀綑鏄庣粏锛屽凡鍒犻櫎鎵樼洏骞堕噸缃叧鑱斿叆搴撳崟鐘舵��");
+ }
+
+ _unitOfWorkManage.CommitTran();
+ return WebResponseContent.Instance.OK($"鏉$爜{barcode}鎾ら攢鎴愬姛锛屾墭鐩樹粛鏈夊墿浣欐槑缁�");
+ }
+
+ // 鍒犻櫎鏁存墭鐩橈紙鏃犳潯鐮佷紶鍏ワ級
+ if (stock.Details == null || !stock.Details.Any())
+ {
+ _stockRepository.DeleteData(stock);
+ _unitOfWorkManage.CommitTran();
+ return WebResponseContent.Instance.OK("鎵樼洏鏃犳槑缁嗚褰曪紝宸茬洿鎺ュ垹闄ゆ墭鐩樹富鏁版嵁");
+ }
+
+ // 鏈夋槑缁� 鈫� 閲嶇疆鍏ュ簱鍗曞強鏄庣粏鐘舵�� + 鍒犻櫎搴撳瓨
+ var relatedOrderNos = stock.Details.Select(d => d.OrderNo).Distinct().ToList();
+ if (!relatedOrderNos.Any())
+ {
+ _unitOfWorkManage.RollbackTran();
+ return WebResponseContent.Instance.Error("搴撳瓨鏄庣粏鏈叧鑱斾换浣曞叆搴撳崟鍙凤紝鏃犳硶瀹屾垚鎾ら攢");
+ }
+
+ // 閲嶇疆鍏ュ簱鍗曚富鐘舵�� + 鏄庣粏鐘舵��
+ ResetInboundOrderStatus(relatedOrderNos, stock.Details.Select(d => d.Barcode).ToList());
+
+ // 4.3 鍒犻櫎搴撳瓨鏄庣粏鍜屼富琛�
+ _stockDetailRepository.DeleteData(stock.Details);
_stockRepository.DeleteData(stock);
- return WebResponseContent.Instance.OK();
+
+ _unitOfWorkManage.CommitTran();
+ return WebResponseContent.Instance.OK("鎵樼洏鎾ら攢鎴愬姛锛屽凡閲嶇疆鍏宠仈鍏ュ簱鍗曞強鏄庣粏鐘舵��");
}
- // 鑾峰彇搴撳瓨璇︽儏鍏宠仈鐨勬墍鏈夊叆搴撳崟鍙�
- var relatedOrderNos = stock.Details.Select(d => d.OrderNo).First();
- // 鏌ヨ鎵�鏈夊叧鑱旂殑鍏ュ簱鍗曪紙鍚鎯咃級
- var inboundOrders = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>()
- .Includes(x => x.Details)
- .Where(x => relatedOrderNos == x.InboundOrderNo)
- .First();
-
- var barcodes = stock.Details.Select(d => d.Barcode).ToList();
-
- // 鍖归厤搴撳瓨鏉$爜瀵瑰簲鐨勫叆搴撳崟鏄庣粏
- var matchedInboundDetails = inboundOrders.Details
- ?.Where(d => barcodes.Contains(d.Barcode))
- .ToList();
- foreach (var detail in matchedInboundDetails)
+ catch (Exception ex)
{
- detail.ReceiptQuantity = 0;
- detail.OrderDetailStatus = 0;
- _inboundOrderDetailRepository.UpdateData(detail);
+ _unitOfWorkManage.RollbackTran();
+ return WebResponseContent.Instance.Error($"鎵樼洏鎾ら攢澶辫触锛歿ex.Message}");
}
- _stockDetailRepository.DeleteData(stock.Details);
- _stockRepository.DeleteData(stock);
+ }
- return WebResponseContent.Instance.OK("鎵樼洏鎾ら攢鎴愬姛");
+ private void ResetInboundOrderStatus(List<string> orderNos, List<string> barcodes = null)
+ {
+ foreach (var orderNo in orderNos)
+ {
+ var inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>()
+ .Includes(x => x.Details)
+ .First(x => x.InboundOrderNo == orderNo);
+
+ if (inboundOrder == null) continue;
+
+ inboundOrder.OrderStatus = 0;
+ _inboundOrderRepository.UpdateData(inboundOrder);
+
+ // 閲嶇疆鍏ュ簱鍗曟槑缁嗙姸鎬�
+ if (inboundOrder.Details == null || !inboundOrder.Details.Any()) continue;
+
+ var targetDetails = barcodes == null
+ ? inboundOrder.Details.ToList() // 涓嶄紶鏉$爜鍒欓噸缃暣鍗曟槑缁�
+ : inboundOrder.Details.Where(d => barcodes.Contains(d.Barcode)).ToList();
+
+ foreach (var detail in targetDetails)
+ {
+ detail.ReceiptQuantity = 0;
+ detail.OrderDetailStatus = 0;
+ _inboundOrderDetailRepository.UpdateData(detail);
+ }
+ }
}
public override PageGridData<Dt_InboundOrder> GetPageData(PageDataOptions options)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs"
index 5246ce1..c91eb7f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs"
@@ -215,9 +215,9 @@
}
[HttpPost, Route("UndoPalletGroup"), AllowAnonymous, MethodParamsValidate]
- public WebResponseContent UndoPalletGroup(string palletCode)
+ public WebResponseContent UndoPalletGroup(string palletCode,string barcode="")
{
- return Service.UndoPalletGroup(palletCode);
+ return Service.UndoPalletGroup(palletCode,barcode);
}
/// <summary>
///
--
Gitblit v1.9.3