Commit 968311d7 authored by 前端-许佳敏's avatar 前端-许佳敏
parents 1b64ae16 ee9e16ad
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-09-16 15:16:47 * @Date: 2020-09-16 15:16:47
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-23 19:14:12 * @LastEditTime: 2020-11-24 17:17:13
* @Description: 联动逻辑相关 * @Description: 联动逻辑相关
*/ */
import { Modal } from 'antd'; import { Modal } from 'antd';
...@@ -36,6 +36,8 @@ import { FORM_FILTER_PATH } from '@/formSchema/const'; ...@@ -36,6 +36,8 @@ import { FORM_FILTER_PATH } from '@/formSchema/const';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { import {
purchaseOrderBillSchema, purchaseOrderBillSchema,
machiningWarehousingBillSchema,
machiningDeliveryBillSchema,
} from '../schema'; } from '../schema';
const { const {
...@@ -116,22 +118,22 @@ const salesOrderColumns: any[] = [ ...@@ -116,22 +118,22 @@ const salesOrderColumns: any[] = [
}, },
]; ];
// 生成通知单列表 // 加工入库单列表
const productionColumns = [ const machiningWarehousingColumns = [
{ {
title: '通知单号', title: '通知单号',
align: 'center', align: 'center',
dataIndex: 'orderNo', dataIndex: 'noticeNo',
}, },
{ {
title: '通知单摘要', title: '通知单摘要',
align: 'center', align: 'center',
dataIndex: 'invoicesAbstract', dataIndex: 'summary',
}, },
{ {
title: '加工企业名称', title: '加工企业名称',
align: 'center', align: 'center',
dataIndex: 'memberName', dataIndex: 'processName',
}, },
{ {
title: '单据时间', title: '单据时间',
...@@ -141,7 +143,36 @@ const productionColumns = [ ...@@ -141,7 +143,36 @@ const productionColumns = [
{ {
title: '申请单状态', title: '申请单状态',
align: 'center', align: 'center',
dataIndex: 'state', dataIndex: 'outerStatusName',
},
];
// 加工发货单列表
const machiningDeliveryColumns = [
{
title: '通知单号',
align: 'center',
dataIndex: 'noticeNo',
},
{
title: '通知单摘要',
align: 'center',
dataIndex: 'summary',
},
{
title: '供应会员',
align: 'center',
dataIndex: 'supplierName',
},
{
title: '单据时间',
align: 'center',
dataIndex: 'createTime',
},
{
title: '申请单状态',
align: 'center',
dataIndex: 'outerStatusName',
}, },
]; ];
...@@ -180,7 +211,13 @@ const fetchOrderPurchaseReceiptAddList = async (params: any) => { ...@@ -180,7 +211,13 @@ const fetchOrderPurchaseReceiptAddList = async (params: any) => {
...params, ...params,
}) })
if (res.code === 1000) { if (res.code === 1000) {
return res.data; return {
data: res.data.data.map(item => ({
...item,
memberName: item.supplyMembersName,
})),
total: res.data.totalCount,
};
} }
return []; return [];
}; };
...@@ -191,7 +228,59 @@ const getOrderSalesInvoiceOrderList = async (params: any) => { ...@@ -191,7 +228,59 @@ const getOrderSalesInvoiceOrderList = async (params: any) => {
...params, ...params,
}) })
if (res.code === 1000) { if (res.code === 1000) {
return res.data; return {
data: res.data.data.map(item => ({
...item,
memberName: item.memberName,
})),
total: res.data.totalCount,
};
}
return [];
};
// 获取加工入库单单相关数据
const getMachiningWarehousingList = async (params: any) => {
const { search, ...rest } = params;
const res = await PublicApi.getEnhanceSupplierToBeAddStorageList({
noticeNo: search,
...rest,
})
if (res.code === 1000) {
return {
data: res.data.data.map(item => ({
...item,
memberName: item.processName,
deliveryAddresId: +item.receiverAddressId,
fullAddress: item.receiveAddress || '',
receiverName: item.receiveUserName || '',
phone: item.receiveUserTel || '',
})),
total: res.data.totalCount,
};
}
return [];
};
// 获取加工发货单单相关数据
const getMachiningDeliveryList = async (params: any) => {
const { search, ...rest } = params;
const res = await PublicApi.getEnhanceProcessToBeAddDeliveryList({
noticeNo: search,
...rest,
})
if (res.code === 1000) {
return {
data: res.data.data.map(item => ({
...item,
memberName: item.supplierName,
deliveryAddresId: +item.receiverAddressId,
fullAddress: item.receiveAddress || '',
receiverName: item.receiveUserName || '',
phone: item.receiveUserTel || '',
})),
total: res.data.totalCount,
};;
} }
return []; return [];
}; };
...@@ -250,13 +339,23 @@ const getParams = type => { ...@@ -250,13 +339,23 @@ const getParams = type => {
break; break;
} }
// 加工入库单
case DOC_TYPE_PROCESS_RECEIPT: {
basicParams.modalProps.title = '选择生产通知单';
basicParams.columns = machiningWarehousingColumns;
basicParams.fetchTableData = getMachiningWarehousingList;
basicParams.formilyProps.ctx.schema = machiningWarehousingBillSchema;
basicParams.tableProps.lableKey = 'noticeNo';
break;
}
// 加工发货单 // 加工发货单
case DOC_TYPE_PROCESS_INVOICE: { case DOC_TYPE_PROCESS_INVOICE: {
basicParams.modalProps.title = '选择生产通知单'; basicParams.modalProps.title = '选择生产通知单';
basicParams.columns = productionColumns; basicParams.columns = machiningDeliveryColumns;
basicParams.fetchTableData = getOrderSalesInvoiceOrderList; basicParams.fetchTableData = getMachiningDeliveryList;
basicParams.formilyProps.ctx.schema = {}; // 缺 basicParams.formilyProps.ctx.schema = machiningDeliveryBillSchema;
basicParams.tableProps.lableKey = 'orderNo'; basicParams.tableProps.lableKey = 'noticeNo';
break; break;
} }
...@@ -329,9 +428,13 @@ export const useBusinessEffects = (context, actions) => { ...@@ -329,9 +428,13 @@ export const useBusinessEffects = (context, actions) => {
} }
linkage.value('relevanceInvoices', undefined); linkage.value('relevanceInvoices', undefined);
linkage.value('invoicesDetailsRequests', []);
linkage.enum('relevanceInvoices', newEnum); linkage.enum('relevanceInvoices', newEnum);
const invoicesDetailsRequestsVal = getFieldValue('invoicesDetailsRequests');
if (invoicesDetailsRequestsVal && invoicesDetailsRequestsVal.length) {
linkage.value('invoicesDetailsRequests', []);
}
const orderNoVal = getFieldValue('orderNo'); const orderNoVal = getFieldValue('orderNo');
if (orderNoVal && orderNoVal.length) { if (orderNoVal && orderNoVal.length) {
linkage.value('orderNo', []); linkage.value('orderNo', []);
...@@ -354,58 +457,11 @@ export const useBusinessEffects = (context, actions) => { ...@@ -354,58 +457,11 @@ export const useBusinessEffects = (context, actions) => {
// 关联单据改变 // 关联单据改变
onFieldValueChange$('orderNo').subscribe(fieldState => { onFieldValueChange$('orderNo').subscribe(fieldState => {
const relevanceInvoicesVal = getFieldValue('relevanceInvoices');
const invoicesTypeIdVal = getFieldValue('invoicesTypeId'); const invoicesTypeIdVal = getFieldValue('invoicesTypeId');
const first = fieldState.value && fieldState.value[0]; const first = fieldState.value && fieldState.value[0];
console.log('first', first)
switch (invoicesTypeIdVal) {
// 采购入库单
case DOC_TYPE_PURCHASE_RECEIPT: {
setFieldValue('memberName', first ? first.supplyMembersName : '');
break;
}
// 销售发货单
case DOC_TYPE_SALES_INVOICE: {
setFieldValue('memberName', first ? first.createMemberName : '');
break;
}
// 加工入库单
case DOC_TYPE_PROCESS_RECEIPT: {
break;
}
// 加工发货单
case DOC_TYPE_PROCESS_INVOICE: {
setFieldValue('memberName', first ? first.supplierName : '');
break;
}
// 退货发货单、退货入库单
case DOC_TYPE_RETURN_INVOICE:
case DOC_TYPE_RETURN_RECEIPT: {
break;
}
// 换货发货单、换货入库单
case DOC_TYPE_EXCHANGE_INVOICE:
case DOC_TYPE_EXCHANGE_RECEIPT: {
break;
}
default: {
break;
}
}
// 设置单据公用的数据相关 // 设置单据公用的数据相关
setFieldValue('memberName', first ? first.memberName : '');
setFieldValue('address', first ? `${first.fullAddress} ${first.receiverName}/${first.phone}` : ''); setFieldValue('address', first ? `${first.fullAddress} ${first.receiverName}/${first.phone}` : '');
// 以下数据只用于收集,不用于展示 // 以下数据只用于收集,不用于展示
...@@ -440,10 +496,35 @@ export const useBusinessEffects = (context, actions) => { ...@@ -440,10 +496,35 @@ export const useBusinessEffects = (context, actions) => {
break; break;
} }
// 加工入库单 // 加工入库单
case DOC_TYPE_PROCESS_RECEIPT: { case DOC_TYPE_PROCESS_RECEIPT: {
// 从加工单详情获取 商品 数据
PublicApi.getEnhanceSupplierToBeAddStorageDetails({
id: first.id,
}).then(res => {
if (res.code !== 1000) {
return;
}
const {
details = [],
deliveryType,
} = res.data;
const goodOptions = details.map(item => ({
label: `${item.productName}${item.orderNo ? '---' + item.orderNo : ''}`,
value: item.productId,
}));
setFieldState('invoicesDetailsRequests.*.product', state => {
FormPath.setIn(state, 'originAsyncData', details.map(item => ({
...item,
// 这里的数据以采购、销售订单的为准
logistics: {
deliveryType, // 手动赋值配送方式,同一个通知单下的所有商品都是统一的配送方式
},
})));
FormPath.setIn(state, 'props.enum', goodOptions);
});
});
break;
break; break;
} }
...@@ -457,14 +538,21 @@ export const useBusinessEffects = (context, actions) => { ...@@ -457,14 +538,21 @@ export const useBusinessEffects = (context, actions) => {
return; return;
} }
const { const {
details, details = [],
deliveryType,
} = res.data; } = res.data;
const goodOptions = details.map(item => ({ const goodOptions = details.map(item => ({
label: `${item.productName}${item.orderNo ? '---' + item.orderNo : ''}`, label: `${item.productName}${item.orderNo ? '---' + item.orderNo : ''}`,
value: item.productId, value: item.productId,
})); }));
setFieldState('invoicesDetailsRequests.*.product', state => { setFieldState('invoicesDetailsRequests.*.product', state => {
FormPath.setIn(state, 'originAsyncData', details); FormPath.setIn(state, 'originAsyncData', details.map(item => ({
...item,
// 这里的数据以采购、销售订单的为准
logistics: {
deliveryType, // 手动赋值配送方式,同一个通知单下的所有商品都是统一的配送方式
},
})));
FormPath.setIn(state, 'props.enum', goodOptions); FormPath.setIn(state, 'props.enum', goodOptions);
}); });
}); });
...@@ -494,7 +582,10 @@ export const useBusinessEffects = (context, actions) => { ...@@ -494,7 +582,10 @@ export const useBusinessEffects = (context, actions) => {
// 关联单据改变 // 关联单据改变
onFieldInputChange$('orderNo').subscribe(fieldState => { onFieldInputChange$('orderNo').subscribe(fieldState => {
setFieldValue('invoicesDetailsRequests', []); const invoicesDetailsRequestsVal = getFieldValue('invoicesDetailsRequests');
if (invoicesDetailsRequestsVal && invoicesDetailsRequestsVal.length) {
linkage.value('invoicesDetailsRequests', []);
}
}); });
// 关联明细 // 关联明细
...@@ -513,6 +604,8 @@ export const useBusinessEffects = (context, actions) => { ...@@ -513,6 +604,8 @@ export const useBusinessEffects = (context, actions) => {
const { name, originAsyncData, value } = fieldState; const { name, originAsyncData, value } = fieldState;
const current = originAsyncData.find(item => item.productId === value); const current = originAsyncData.find(item => item.productId === value);
console.log('current', current)
// 取消选择 // 取消选择
if (!value) { if (!value) {
setFieldState( setFieldState(
...@@ -536,7 +629,7 @@ export const useBusinessEffects = (context, actions) => { ...@@ -536,7 +629,7 @@ export const useBusinessEffects = (context, actions) => {
return `invoicesDetailsRequests.${$1}.price` return `invoicesDetailsRequests.${$1}.price`
}), }),
state => { state => {
state.value = ''; state.value = null;
} }
); );
setFieldState( setFieldState(
...@@ -552,7 +645,7 @@ export const useBusinessEffects = (context, actions) => { ...@@ -552,7 +645,7 @@ export const useBusinessEffects = (context, actions) => {
return `invoicesDetailsRequests.${$1}.amount` return `invoicesDetailsRequests.${$1}.amount`
}), }),
state => { state => {
state.value = `¥0.00`; state.value = null;
} }
); );
// 配送方式,一个单据只能有一个配送方式 // 配送方式,一个单据只能有一个配送方式
...@@ -574,6 +667,25 @@ export const useBusinessEffects = (context, actions) => { ...@@ -574,6 +667,25 @@ export const useBusinessEffects = (context, actions) => {
setFieldValue('transport', ''); setFieldValue('transport', '');
setFieldValue('deliveryType', null); setFieldValue('deliveryType', null);
} }
// 加工发货单
setFieldState(
FormPath.transform(name, /\d/, $1 => {
return `invoicesDetailsRequests.${$1}.orderNo`
}),
state => {
state.value = '';
}
);
// 加工发货单
setFieldState(
FormPath.transform(name, /\d/, $1 => {
return `invoicesDetailsRequests.${$1}.id`
}),
state => {
state.value = '';
}
);
} }
if (!current) { if (!current) {
...@@ -601,7 +713,7 @@ export const useBusinessEffects = (context, actions) => { ...@@ -601,7 +713,7 @@ export const useBusinessEffects = (context, actions) => {
return `invoicesDetailsRequests.${$1}.price` return `invoicesDetailsRequests.${$1}.price`
}), }),
state => { state => {
state.value = current.price ? current.price.toFixed(2) : ''; state.value = current.price ? current.price.toFixed(2) : null;
} }
); );
setFieldState( setFieldState(
...@@ -617,7 +729,7 @@ export const useBusinessEffects = (context, actions) => { ...@@ -617,7 +729,7 @@ export const useBusinessEffects = (context, actions) => {
return `invoicesDetailsRequests.${$1}.amount` return `invoicesDetailsRequests.${$1}.amount`
}), }),
state => { state => {
state.value = current.price ? `¥${(current.purchaseCount * current.price).toFixed(2)}` : ''; state.value = current.price ? `¥${(current.purchaseCount * current.price).toFixed(2)}` : null;
} }
); );
// 配送方式,一个单据只能有一个配送方式 // 配送方式,一个单据只能有一个配送方式
...@@ -629,6 +741,24 @@ export const useBusinessEffects = (context, actions) => { ...@@ -629,6 +741,24 @@ export const useBusinessEffects = (context, actions) => {
state.value = current.logistics && current.logistics.deliveryType ? current.logistics.deliveryType : undefined; state.value = current.logistics && current.logistics.deliveryType ? current.logistics.deliveryType : undefined;
} }
); );
// 加工发货单
setFieldState(
FormPath.transform(name, /\d/, $1 => {
return `invoicesDetailsRequests.${$1}.orderNo`
}),
state => {
state.value = current.orderNo;
}
);
// 加工发货单
setFieldState(
FormPath.transform(name, /\d/, $1 => {
return `invoicesDetailsRequests.${$1}.id`
}),
state => {
state.value = current.id;
}
);
setTimeout(() => { setTimeout(() => {
const invoicesDetailsRequestsValue = getFieldValue('invoicesDetailsRequests'); const invoicesDetailsRequestsValue = getFieldValue('invoicesDetailsRequests');
...@@ -678,13 +808,13 @@ export const useBusinessEffects = (context, actions) => { ...@@ -678,13 +808,13 @@ export const useBusinessEffects = (context, actions) => {
state => state.value, state => state.value,
); );
const current = originAsyncData ? originAsyncData.find(item => item.productId === goodId) : null; const current = originAsyncData ? originAsyncData.find(item => item.productId === goodId) : null;
const invoicesTypeIdVal = getFieldValue('invoicesTypeId');
if (!current) { if (!current) {
return; return;
} }
if (+value > current.purchaseCount) { if (+value > current.purchaseCount) {
Modal.destroyAll();
Modal.confirm({ Modal.confirm({
title: '提示', title: '提示',
content: '单据数量已超过商品数量', content: '单据数量已超过商品数量',
...@@ -698,7 +828,7 @@ export const useBusinessEffects = (context, actions) => { ...@@ -698,7 +828,7 @@ export const useBusinessEffects = (context, actions) => {
return `invoicesDetailsRequests.${$1}.amount` return `invoicesDetailsRequests.${$1}.amount`
}), }),
state => { state => {
state.value = current.price ? `¥${(+value * current.price).toFixed(2)}` : ''; state.value = current.price ? `¥${(+value * current.price).toFixed(2)}` : null;
} }
); );
}); });
......
...@@ -274,7 +274,7 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -274,7 +274,7 @@ const BillsForm: React.FC<BillsFormProps> = ({
orderNo, orderNo,
id: +relevanceInvoicesId, id: +relevanceInvoicesId,
deliveryAddresId: +deliveryAddresId, deliveryAddresId: +deliveryAddresId,
createMemberName, memberName: createMemberName,
fullAddress: deliveryAddressInfo.fullAddress || '', fullAddress: deliveryAddressInfo.fullAddress || '',
receiverName: deliveryAddressInfo.receiverName || '', receiverName: deliveryAddressInfo.receiverName || '',
phone: deliveryAddressInfo.phone || '', phone: deliveryAddressInfo.phone || '',
...@@ -292,7 +292,45 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -292,7 +292,45 @@ const BillsForm: React.FC<BillsFormProps> = ({
// 加工入库单 // 加工入库单
case DOC_TYPE_PROCESS_RECEIPT: { case DOC_TYPE_PROCESS_RECEIPT: {
setInfoLoading(true);
PublicApi.getEnhanceSupplierToBeAddStorageDetails({
id: relevanceInvoicesId,
}).then(res => {
if (res.code !== 1000) {
return;
}
const {
processName,
receiverAddressId,
noticeNo,
receiveAddress,
receiveUserName,
receiveUserTel,
deliveryType,
} = res.data;
setBillInfo({
invoicesTypeId: intInvoicesTypeId,
relevanceInvoices: +relevanceInvoices,
orderNo:
relevanceInvoicesId ?
[
{
orderNo: noticeNo,
id: +relevanceInvoicesId,
deliveryAddresId: +receiverAddressId,
memberName: processName,
fullAddress: receiveAddress || '',
receiverName: receiveUserName || '',
phone: receiveUserTel || '',
}
] :
[]
,
});
}).finally(() => {
setInfoLoading(false);
});
break; break;
} }
...@@ -325,11 +363,10 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -325,11 +363,10 @@ const BillsForm: React.FC<BillsFormProps> = ({
orderNo: noticeNo, orderNo: noticeNo,
id: +relevanceInvoicesId, id: +relevanceInvoicesId,
deliveryAddresId: +receiverAddressId, deliveryAddresId: +receiverAddressId,
supplierName, memberName: supplierName,
fullAddress: receiveAddress || '', fullAddress: receiveAddress || '',
receiverName: receiveUserName || '', receiverName: receiveUserName || '',
phone: receiveUserTel || '', phone: receiveUserTel || '',
// isDefault: deliveryAddressInfo.isDefault,
} }
] : ] :
[] []
...@@ -399,6 +436,7 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -399,6 +436,7 @@ const BillsForm: React.FC<BillsFormProps> = ({
</Button> </Button>
) : null; ) : null;
// 提交
const handleSubmit = value => { const handleSubmit = value => {
const { const {
invoicesTypeId, invoicesTypeId,
...@@ -421,14 +459,6 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -421,14 +459,6 @@ const BillsForm: React.FC<BillsFormProps> = ({
})); }));
const newTransactionTime = transactionTime ? moment(transactionTime).valueOf() : null; const newTransactionTime = transactionTime ? moment(transactionTime).valueOf() : null;
const payload = {
orderNo: orderNo[0].orderNo,
relevanceInvoicesId: orderNo[0].id,
transactionTime: newTransactionTime,
invoicesDetailsRequests: newInvoicesDetailsRequests,
...rest,
};
setSubmitLoading(true); setSubmitLoading(true);
switch (invoicesTypeId) { switch (invoicesTypeId) {
// 采购入库单 // 采购入库单
...@@ -438,7 +468,14 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -438,7 +468,14 @@ const BillsForm: React.FC<BillsFormProps> = ({
return; return;
} }
PublicApi.postOrderPurchaseReceiptAdd({ PublicApi.postOrderPurchaseReceiptAdd({
...payload, ...rest,
orderNo: orderNo[0].orderNo,
relevanceInvoicesId: orderNo[0].id,
transactionTime: newTransactionTime,
invoicesDetailsRequests: newInvoicesDetailsRequests.map(item => ({
...item,
itemNmae: item.itemName,
})),
supplyMembersName: memberName, supplyMembersName: memberName,
}) })
.then(res => { .then(res => {
...@@ -459,11 +496,14 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -459,11 +496,14 @@ const BillsForm: React.FC<BillsFormProps> = ({
} }
PublicApi.postWarehouseInvoicesUpdata({ PublicApi.postWarehouseInvoicesUpdata({
id: +id, id: +id,
invoicesAbstract: payload.invoicesAbstract, invoicesAbstract: rest.invoicesAbstract,
inventoryId: payload.inventoryId, inventoryId: rest.inventoryId,
inventoryRole: payload.inventoryRole, inventoryRole: rest.inventoryRole,
transactionTime: payload.transactionTime, transactionTime: newTransactionTime,
invoicesDetailsRequests: payload.invoicesDetailsRequests, invoicesDetailsRequests: newInvoicesDetailsRequests.map(item => ({
...item,
itemNmae: item.itemName,
})),
}) })
.then(res => { .then(res => {
if (res.code !== 1000) { if (res.code !== 1000) {
...@@ -487,7 +527,14 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -487,7 +527,14 @@ const BillsForm: React.FC<BillsFormProps> = ({
return; return;
} }
PublicApi.postOrderSalesInvoiceOrder({ PublicApi.postOrderSalesInvoiceOrder({
...payload, ...rest,
orderNo: orderNo[0].orderNo,
relevanceInvoicesId: orderNo[0].id,
transactionTime: newTransactionTime,
invoicesDetailsRequests: newInvoicesDetailsRequests.map(item => ({
...item,
itemNmae: item.itemName,
})),
createMemberName: memberName, createMemberName: memberName,
}) })
.then(res => { .then(res => {
...@@ -508,11 +555,14 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -508,11 +555,14 @@ const BillsForm: React.FC<BillsFormProps> = ({
} }
PublicApi.postWarehouseInvoicesUpdata({ PublicApi.postWarehouseInvoicesUpdata({
id: +id, id: +id,
invoicesAbstract: payload.invoicesAbstract, invoicesAbstract: rest.invoicesAbstract,
inventoryId: payload.inventoryId, inventoryId: rest.inventoryId,
inventoryRole: payload.inventoryRole, inventoryRole: rest.inventoryRole,
transactionTime: payload.transactionTime, transactionTime: newTransactionTime,
invoicesDetailsRequests: payload.invoicesDetailsRequests, invoicesDetailsRequests: newInvoicesDetailsRequests.map(item => ({
...item,
itemNmae: item.itemName,
})),
}) })
.then(res => { .then(res => {
if (res.code !== 1000) { if (res.code !== 1000) {
...@@ -531,13 +581,79 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -531,13 +581,79 @@ const BillsForm: React.FC<BillsFormProps> = ({
// 加工入库单 // 加工入库单
case DOC_TYPE_PROCESS_RECEIPT: { case DOC_TYPE_PROCESS_RECEIPT: {
if (!id) {
if (isEdit) {
return;
}
PublicApi.postEnhanceSupplierToBeAddStorageSubmit({
produceNoticeOrderId: orderNo[0].id,
warehouseId: rest.inventoryId,
warehouseRole: rest.inventoryRole,
storageSummary: rest.invoicesAbstract,
storageTime: newTransactionTime,
storageDetailsDTOList: newInvoicesDetailsRequests.map(item => ({
...item,
produceNoticeOrderDetailId: item.id,
storageCount: item.productCount,
})),
})
.then(res => {
if (res.code !== 1000) {
return;
}
setUnsaved(false);
setTimeout(() => {
history.goBack();
}, 800);
}).finally(() => {
setSubmitLoading(false);
});
} else {
// update action
if (!isEdit) {
return;
}
}
break; break;
} }
// 加工发货单 // 加工发货单
case DOC_TYPE_PROCESS_INVOICE: { case DOC_TYPE_PROCESS_INVOICE: {
if (!id) {
if (isEdit) {
return;
}
PublicApi.postEnhanceProcessToBeAddDeliverySubmit({
produceNoticeOrderId: orderNo[0].id,
warehouseId: rest.inventoryId,
warehouseRole: rest.inventoryRole,
invoiceSummary: rest.invoicesAbstract,
invoiceTime: newTransactionTime,
invoiceDetailsDTOList: newInvoicesDetailsRequests.map(item => ({
...item,
produceNoticeOrderDetailId: item.id,
shipmentQuantity: item.productCount,
})),
})
.then(res => {
if (res.code !== 1000) {
return;
}
setUnsaved(false);
setTimeout(() => {
history.goBack();
}, 800);
}).finally(() => {
setSubmitLoading(false);
});
} else {
// update action
if (!isEdit) {
return;
}
}
break; break;
} }
...@@ -582,7 +698,7 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -582,7 +698,7 @@ const BillsForm: React.FC<BillsFormProps> = ({
const atom = { const atom = {
itemNo: item.code, itemNo: item.code,
goodsId: item.id, goodsId: item.id,
itemNmae: item.name, itemName: item.name,
specifications: item.type, specifications: item.type,
category: item.customerCategory ? item.customerCategory.name : '', category: item.customerCategory ? item.customerCategory.name : '',
brand: item.brand ? item.brand.name : '', brand: item.brand ? item.brand.name : '',
......
...@@ -419,7 +419,7 @@ export const addBillSchema: ISchema = { ...@@ -419,7 +419,7 @@ export const addBillSchema: ISchema = {
title: '货号', title: '货号',
'x-component': 'Text', 'x-component': 'Text',
}, },
itemNmae: { itemName: {
type: 'string', type: 'string',
title: '货品名称', title: '货品名称',
'x-component': 'Text', 'x-component': 'Text',
...@@ -508,6 +508,16 @@ export const addBillSchema: ISchema = { ...@@ -508,6 +508,16 @@ export const addBillSchema: ISchema = {
type: 'string', type: 'string',
display: false, display: false,
}, },
// 明细 商品记录id(加工发货单需要),不用于展示,只收集值
id: {
type: 'string',
display: false,
},
// 订单号(加工发货单需要),不用于展示,只收集值
orderNo: {
type: 'string',
display: false,
},
}, },
} }
}, },
...@@ -520,6 +530,7 @@ export const addBillSchema: ISchema = { ...@@ -520,6 +530,7 @@ export const addBillSchema: ISchema = {
}, },
}; };
// 采购入库单、销售发货单订单 弹窗 search schema
export const purchaseOrderBillSchema: ISchema = { export const purchaseOrderBillSchema: ISchema = {
type: 'object', type: 'object',
properties: { properties: {
...@@ -608,6 +619,138 @@ export const purchaseOrderBillSchema: ISchema = { ...@@ -608,6 +619,138 @@ export const purchaseOrderBillSchema: ISchema = {
}, },
}; };
// 加工入库单 弹窗 search schema
export const machiningWarehousingBillSchema: ISchema = {
type: 'object',
properties: {
megaLayout: {
type: 'object',
'x-component': 'Mega-Layout',
properties: {
search: {
type: 'string',
'x-component': 'Search',
'x-mega-props': {},
'x-component-props': {
placeholder: '搜索',
align: 'flex-start',
tip: '输入 通知单号 进行搜索',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
grid: true,
full: true,
autoRow: true,
columns: 3,
},
properties: {
summary: {
type: 'string',
'x-component-props': {
placeholder: '通知单摘要',
allowClear: true,
},
},
processName: {
type: 'string',
'x-component-props': {
placeholder: '加工企业',
allowClear: true,
},
},
'[startTime, endTime]': {
type: 'string',
'x-component': 'DateSelect',
'x-component-props': {
placeholder: '单据时间',
allowClear: true,
},
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
}
}
},
},
},
},
},
};
// 加工发货单 弹窗 search schema
export const machiningDeliveryBillSchema: ISchema = {
type: 'object',
properties: {
megaLayout: {
type: 'object',
'x-component': 'Mega-Layout',
properties: {
search: {
type: 'string',
'x-component': 'Search',
'x-mega-props': {},
'x-component-props': {
placeholder: '搜索',
align: 'flex-start',
tip: '输入 通知单号 进行搜索',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
grid: true,
full: true,
autoRow: true,
columns: 3,
},
properties: {
summary: {
type: 'string',
'x-component-props': {
placeholder: '通知单摘要',
allowClear: true,
},
},
supplierName: {
type: 'string',
'x-component-props': {
placeholder: '供应会员',
allowClear: true,
},
},
'[startTime, endTime]': {
type: 'string',
'x-component': 'DateSelect',
'x-component-props': {
placeholder: '单据时间',
allowClear: true,
},
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
}
}
},
},
},
},
},
};
export const goodsSearchSchema: ISchema = { export const goodsSearchSchema: ISchema = {
type: 'object', type: 'object',
properties: { properties: {
......
...@@ -42,13 +42,7 @@ const Inventory: React.FC<{}> = () => { ...@@ -42,13 +42,7 @@ const Inventory: React.FC<{}> = () => {
title: '商品名称', title: '商品名称',
dataIndex: 'goodsName', dataIndex: 'goodsName',
align: 'center', align: 'center',
render: (text: any, record: any) => ( render: (text: any, record: any) => text,
<EyePreview
url={`/repositories/viewRepository?id=${record.id}&preview=1`}
>
{text}
</EyePreview>
),
}, },
{ {
title: '规格型号', title: '规格型号',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment