Commit f1b86ebec91c81de791326943579d1e3f09a3aff

Authored by zhongnanhuang
1 parent 98b84d37

feat: update 金蝶商品获取

src/pages/Order/components/FinancialReceiptsModal.tsx
... ... @@ -49,7 +49,7 @@ export default ({ setVisible, onClose }) => {
49 49 ];
50 50 const [editableKeys, setEditableRowKeys] = useState<React.Key[]>(() =>
51 51 // defaultData.map((item) => item.id),
52   - [3, 4],
  52 + [1, 2, 3, 4],
53 53 );
54 54 const columns: ProColumns<DataSourceType>[] = [
55 55 {
... ...
src/pages/Order/components/OrderDrawer.tsx
1 1 import { RESPONSE_CODE } from '@/constants/enum';
2 2 import {
  3 + postKingdeeRepMaterial,
  4 + postKingdeeRepMaterialStock,
3 5 postServiceOrderAddOrder,
4 6 postServiceOrderQueryCustomerNameInformation,
5   - postServiceOrderQueryProductInformation,
6 7 postServiceOrderQuerySalesCode,
7 8 postServiceOrderUpdateOrder,
8 9 } from '@/services';
... ... @@ -37,6 +38,9 @@ import {
37 38 export default ({ onClose, data, subOrders, orderOptType }) => {
38 39 const [invoicingStatus, setInvoicingStatus] = useState('');
39 40 const [salesCodeOptions, setSalesCodeOptions] = useState([]);
  41 + const [productInvStockOptionsList, setProductInvStockOptionsList] = useState(
  42 + [],
  43 + ); //商品的仓库选项
40 44 const [form] = Form.useForm<{
41 45 salesCode: '';
42 46 customerName: '';
... ... @@ -185,13 +189,30 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
185 189 * @param option 商品名称所对应的商品数据
186 190 * @param currentRowData list中当前行的数据
187 191 */
188   - function autoFillProductInfo(option: any, currentRowData: any) {
  192 + async function autoFillProductInfo(
  193 + option: any,
  194 + currentRowData: any,
  195 + index: any,
  196 + ) {
189 197 let copyList = form.getFieldValue('list');
190 198 let currentData = copyList[currentRowData.field.key];
191   - currentData.productCode = option?.productCode;
192   - currentData.parameters = option?.specifications;
193   - currentData.unit = option?.unit;
  199 + currentData.productCode = option?.number;
  200 + currentData.parameters = option?.model;
  201 + currentData.unit = option?.base_unit_name;
194 202 form.setFieldValue('list', copyList);
  203 +
  204 + //商品所在的仓库选项填充
  205 + console.log(currentData);
  206 + let res = await postKingdeeRepMaterialStock({
  207 + data: {
  208 + material_id: option.id,
  209 + },
  210 + });
  211 + let newProductInvStockOptionsList = [...productInvStockOptionsList];
  212 + newProductInvStockOptionsList[index] = res?.rows?.map((item) => {
  213 + return { label: item.inv_stock, value: item.inv_stock_id };
  214 + });
  215 + setProductInvStockOptionsList(newProductInvStockOptionsList);
195 216 }
196 217  
197 218 /**
... ... @@ -648,15 +669,15 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
648 669 placeholder="请搜索商品"
649 670 rules={[{ required: true, message: '商品名称必填' }]}
650 671 onChange={(_, option) => {
651   - autoFillProductInfo(option, listMeta);
  672 + autoFillProductInfo(option, listMeta, listMeta.index);
652 673 }}
653 674 fieldProps={{
654 675 optionItemRender(item) {
655 676 if (item.type === 'add') {
656 677 return (
657   - <div title={item.productName + '(新增商品信息)'}>
  678 + <div title={item.name + '(新增商品信息)'}>
658 679 <span style={{ color: '#333333' }}>
659   - {item.productName}
  680 + {item.name}
660 681 </span>
661 682 {' | '}
662 683 <span style={{ color: 'orange' }}>新增商品</span>
... ... @@ -668,40 +689,37 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
668 689 title={
669 690 item.label +
670 691 ' | ' +
671   - (item.specifications === undefined
672   - ? '无参数'
673   - : item.specifications) +
  692 + (item.model === undefined ? '无参数' : item.model) +
674 693 ' | ' +
675   - item.unit
  694 + item.base_unit_name
676 695 }
677 696 >
678 697 <span style={{ color: '#333333' }}>{item.label}</span>
679 698 {' | '}
680 699 <span style={{ color: '#339999' }}>
681   - {item.specifications === undefined
682   - ? '无参数'
683   - : item.specifications}
  700 + {item.model === undefined ? '无参数' : item.model}
684 701 </span>
685 702 {' | '}
686 703 <span style={{ color: '#666666' }}>
687   - {item.unit === undefined ? '无单位' : item.unit}
  704 + {item.base_unit_name === undefined
  705 + ? '无单位'
  706 + : item.base_unit_name}
688 707 </span>
689 708 </div>
690 709 );
691 710 },
692 711 }}
693   - request={async (value, { params }) => {
  712 + debounceTime={1000}
  713 + request={async (value) => {
694 714 const keywords = value.keyWords;
695   - const { data } =
696   - await postServiceOrderQueryProductInformation({
697   - data: { productName: keywords },
698   - params: params,
699   - });
700   - let options = data.map((p: any) => {
  715 + const res = await postKingdeeRepMaterial({
  716 + data: { search: keywords },
  717 + });
  718 + let options = res?.rows?.map((p: any) => {
701 719 return {
702 720 ...p,
703   - label: p.productName,
704   - value: p.id + '|' + p.productName,
  721 + label: p.name,
  722 + value: p.id + '|' + p.name,
705 723 key: p.id,
706 724 };
707 725 });
... ... @@ -719,20 +737,13 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
719 737 return options;
720 738 }}
721 739 />,
722   - <ProFormText
723   - key={'productCode' + listMeta.index}
  740 + <ProFormSelect
  741 + key="inv_stock"
  742 + placeholder="请选择商品仓库"
  743 + name="invStock"
724 744 width="lg"
725   - name="productCode"
726   - disabled
727   - label={
728   - <>
729   - <span>商品编码</span>
730   - <span className="pl-2 text-xs text-gray-400">
731   - 新增商品时,商品编码由系统自动生成
732   - </span>
733   - </>
734   - }
735   - placeholder="未输入商品名称"
  745 + label="仓库"
  746 + options={productInvStockOptionsList[listMeta.index]}
736 747 />,
737 748 <ProFormText
738 749 key={'parameters' + listMeta.index}
... ...
src/pages/Order/index.tsx
... ... @@ -898,23 +898,6 @@ const OrderPage = () =&gt; {
898 898 ''
899 899 )}
900 900  
901   - {false ? (
902   - <Button
903   - className="p-0"
904   - type="link"
905   - onClick={() => {
906   - setFinancialReceiptsModalVisible(true);
907   - setOrderRow(record);
908   - setSelectedRows([optRecord]);
909   - setIsEdit(true);
910   - }}
911   - >
912   - 收款记录
913   - </Button>
914   - ) : (
915   - ''
916   - )}
917   -
918 901 {optRecord.subPath?.includes('invoicing') ? (
919 902 <Button
920 903 className="p-0"
... ... @@ -1419,6 +1402,22 @@ const OrderPage = () =&gt; {
1419 1402 <Flex justify="flex-end">
1420 1403 <Space.Compact direction="vertical" align="end">
1421 1404 <Space>
  1405 + {record.mainPath?.includes('updateHirePurchase') ? (
  1406 + <Button
  1407 + className="p-0"
  1408 + type="link"
  1409 + onClick={() => {
  1410 + setFinancialReceiptsModalVisible(true);
  1411 + setOrderRow(record);
  1412 + setSelectedRows([record]);
  1413 + setIsEdit(true);
  1414 + }}
  1415 + >
  1416 + 收款记录
  1417 + </Button>
  1418 + ) : (
  1419 + ''
  1420 + )}
1422 1421 {record.mainPath?.includes('procureConvertProcure') ? (
1423 1422 <Button
1424 1423 className="p-0"
... ...
src/services/definition.ts
... ... @@ -370,6 +370,87 @@ export interface FilePathDto {
370 370 url?: string;
371 371 }
372 372  
  373 +export interface InventoryMaterialStockReq {
  374 + auxPropId?: string;
  375 + isShowStockPosition?: boolean;
  376 + isShowZeroImQty?: boolean;
  377 + materialId?: string;
  378 +}
  379 +
  380 +export interface MaterialListReply {
  381 + count?: string;
  382 + /** @format int32 */
  383 + currentPage?: number;
  384 + /** @format int32 */
  385 + currentPageSize?: number;
  386 + /** @format int32 */
  387 + page?: number;
  388 + /** @format int32 */
  389 + pageSize?: number;
  390 + rows?: Array<MaterialListReplyRow>;
  391 + /** @format int32 */
  392 + totalPage?: number;
  393 +}
  394 +
  395 +export interface MaterialListReplyRow {
  396 + barcode?: string;
  397 + baseUnitId?: string;
  398 + baseUnitName?: string;
  399 + baseUnitNumber?: string;
  400 + brandId?: string;
  401 + brandName?: string;
  402 + brandNumber?: string;
  403 + checkType?: string;
  404 + helpCode?: string;
  405 + id?: string;
  406 + isAsstAttr?: boolean;
  407 + isBatch?: boolean;
  408 + isKfPeriod?: boolean;
  409 + isMultiUnit?: boolean;
  410 + isSerial?: boolean;
  411 + isShowAuxBarcode?: boolean;
  412 + isWeight?: boolean;
  413 + model?: string;
  414 + mulLabel?: Array<Mullabel>;
  415 + name?: string;
  416 + number?: string;
  417 + parentId?: string;
  418 + parentName?: string;
  419 + parentNumber?: string;
  420 + producingPace?: string;
  421 + remark?: string;
  422 + units?: Array<Unit>;
  423 + url?: string;
  424 +}
  425 +
  426 +export interface MaterialMaterialListReq {
  427 + createEndTime?: string;
  428 + createStartTime?: string;
  429 + enable?: string;
  430 + ids?: Array<string>;
  431 + isDataPerm?: boolean;
  432 + modifyEndTime?: string;
  433 + modifyStartTime?: string;
  434 + page?: string;
  435 + pageSize?: string;
  436 + parent?: Array<string>;
  437 + search?: string;
  438 + showUnits?: boolean;
  439 +}
  440 +
  441 +export interface MaterialStockRes {
  442 + rows?: Array<MaterialStockRow>;
  443 +}
  444 +
  445 +export interface MaterialStockRow {
  446 + invBaseUnit?: string;
  447 + invImQty?: string;
  448 + invQty?: string;
  449 + invStock?: string;
  450 + invStockId?: string;
  451 + invStockPosition?: string;
  452 +}
  453 +
373 454 export interface ModelAndView {
374 455 empty?: boolean;
375 456 model?: any;
... ... @@ -382,6 +463,12 @@ export interface ModelAndView {
382 463 viewName?: string;
383 464 }
384 465  
  466 +export interface Mullabel {
  467 + id?: string;
  468 + name?: string;
  469 + number?: string;
  470 +}
  471 +
385 472 export interface OrderAddVO {
386 473 baseInfo?: OrderBaseInfoVO;
387 474 inspectionStageInfo?: OrderInspectionStageVO;
... ... @@ -891,6 +978,46 @@ export interface SysLogQueryVO {
891 978 username?: string;
892 979 }
893 980  
  981 +export interface Unit {
  982 + /** @format float */
  983 + coefficient?: number;
  984 + conversionUnitConversionType?: string;
  985 + conversionUnitCreatetime?: string;
  986 + conversionUnitDisableDate?: string;
  987 + conversionUnitEnable?: string;
  988 + conversionUnitId?: string;
  989 + conversionUnitIsLeaf?: boolean;
  990 + /** @format int32 */
  991 + conversionUnitLevel?: number;
  992 + conversionUnitLongNumber?: string;
  993 + conversionUnitModifyTime?: string;
  994 + conversionUnitName?: string;
  995 + conversionUnitNumber?: string;
  996 + conversionUnitPrecision?: string;
  997 + conversionUnitPrecisionAccount?: string;
  998 + id?: string;
  999 + /** @format int32 */
  1000 + index?: number;
  1001 + isDefault?: boolean;
  1002 + isFloat?: boolean;
  1003 + materialId?: string;
  1004 + unitConversionType?: string;
  1005 + unitCreateTime?: string;
  1006 + unitDisableDate?: string;
  1007 + unitEnable?: string;
  1008 + unitId?: string;
  1009 + unitIsLeaf?: boolean;
  1010 + /** @format int32 */
  1011 + unitLevel?: number;
  1012 + unitLongNumber?: string;
  1013 + unitModifyTime?: string;
  1014 + unitNumber?: string;
  1015 + unitPrecision?: string;
  1016 + /** @format int32 */
  1017 + unitPrecisionAccount?: number;
  1018 + unitidName?: string;
  1019 +}
  1020 +
894 1021 export interface UpdatePwdVO {
895 1022 confirmPassword?: string;
896 1023 password?: string;
... ...
src/services/request.ts
... ... @@ -26,6 +26,10 @@ import type {
26 26 DictionaryQueryVO,
27 27 DictionaryVO,
28 28 Dto,
  29 + InventoryMaterialStockReq,
  30 + MaterialListReply,
  31 + MaterialMaterialListReq,
  32 + MaterialStockRes,
29 33 ModelAndView,
30 34 OrderAddVO,
31 35 OrderAuditLogQueryVO,
... ... @@ -567,8 +571,8 @@ export const patchError = /* #__PURE__ */ (() =&gt; {
567 571 return request;
568 572 })();
569 573  
570   -/** @description response type for getKingdeeTestGetToken */
571   -export interface GetKingdeeTestGetTokenResponse {
  574 +/** @description response type for getKingdeeRepGetToken */
  575 +export interface GetKingdeeRepGetTokenResponse {
572 576 /**
573 577 * @description
574 578 * OK
... ... @@ -591,21 +595,163 @@ export interface GetKingdeeTestGetTokenResponse {
591 595 404: any;
592 596 }
593 597  
594   -export type GetKingdeeTestGetTokenResponseSuccess =
595   - GetKingdeeTestGetTokenResponse[200];
  598 +export type GetKingdeeRepGetTokenResponseSuccess =
  599 + GetKingdeeRepGetTokenResponse[200];
596 600 /**
597 601 * @description
598 602 * getToken
599   - * @tags kingdee-test-controller
  603 + * @tags kingdee-erp-controller
600 604 * @produces *
601 605 */
602   -export const getKingdeeTestGetToken = /* #__PURE__ */ (() => {
  606 +export const getKingdeeRepGetToken = /* #__PURE__ */ (() => {
603 607 const method = 'get';
604   - const url = '/kingdee/test/getToken';
605   - function request(): Promise<GetKingdeeTestGetTokenResponseSuccess> {
  608 + const url = '/kingdee/rep/getToken';
  609 + function request(): Promise<GetKingdeeRepGetTokenResponseSuccess> {
606 610 return requester(request.url, {
607 611 method: request.method,
608   - }) as unknown as Promise<GetKingdeeTestGetTokenResponseSuccess>;
  612 + }) as unknown as Promise<GetKingdeeRepGetTokenResponseSuccess>;
  613 + }
  614 +
  615 + /** http method */
  616 + request.method = method;
  617 + /** request url */
  618 + request.url = url;
  619 + return request;
  620 +})();
  621 +
  622 +/** @description request parameter type for postKingdeeRepMaterial */
  623 +export interface PostKingdeeRepMaterialOption {
  624 + /**
  625 + * @description
  626 + * req
  627 + */
  628 + body: {
  629 + /**
  630 + @description
  631 + req */
  632 + req: MaterialMaterialListReq;
  633 + };
  634 +}
  635 +
  636 +/** @description response type for postKingdeeRepMaterial */
  637 +export interface PostKingdeeRepMaterialResponse {
  638 + /**
  639 + * @description
  640 + * OK
  641 + */
  642 + 200: MaterialListReply;
  643 + /**
  644 + * @description
  645 + * Created
  646 + */
  647 + 201: any;
  648 + /**
  649 + * @description
  650 + * Unauthorized
  651 + */
  652 + 401: any;
  653 + /**
  654 + * @description
  655 + * Forbidden
  656 + */
  657 + 403: any;
  658 + /**
  659 + * @description
  660 + * Not Found
  661 + */
  662 + 404: any;
  663 +}
  664 +
  665 +export type PostKingdeeRepMaterialResponseSuccess =
  666 + PostKingdeeRepMaterialResponse[200];
  667 +/**
  668 + * @description
  669 + * listMaterial
  670 + * @tags kingdee-erp-controller
  671 + * @produces *
  672 + * @consumes application/json
  673 + */
  674 +export const postKingdeeRepMaterial = /* #__PURE__ */ (() => {
  675 + const method = 'post';
  676 + const url = '/kingdee/rep/material';
  677 + function request(
  678 + option: PostKingdeeRepMaterialOption,
  679 + ): Promise<PostKingdeeRepMaterialResponseSuccess> {
  680 + return requester(request.url, {
  681 + method: request.method,
  682 + ...option,
  683 + }) as unknown as Promise<PostKingdeeRepMaterialResponseSuccess>;
  684 + }
  685 +
  686 + /** http method */
  687 + request.method = method;
  688 + /** request url */
  689 + request.url = url;
  690 + return request;
  691 +})();
  692 +
  693 +/** @description request parameter type for postKingdeeRepMaterialStock */
  694 +export interface PostKingdeeRepMaterialStockOption {
  695 + /**
  696 + * @description
  697 + * req
  698 + */
  699 + body: {
  700 + /**
  701 + @description
  702 + req */
  703 + req: InventoryMaterialStockReq;
  704 + };
  705 +}
  706 +
  707 +/** @description response type for postKingdeeRepMaterialStock */
  708 +export interface PostKingdeeRepMaterialStockResponse {
  709 + /**
  710 + * @description
  711 + * OK
  712 + */
  713 + 200: MaterialStockRes;
  714 + /**
  715 + * @description
  716 + * Created
  717 + */
  718 + 201: any;
  719 + /**
  720 + * @description
  721 + * Unauthorized
  722 + */
  723 + 401: any;
  724 + /**
  725 + * @description
  726 + * Forbidden
  727 + */
  728 + 403: any;
  729 + /**
  730 + * @description
  731 + * Not Found
  732 + */
  733 + 404: any;
  734 +}
  735 +
  736 +export type PostKingdeeRepMaterialStockResponseSuccess =
  737 + PostKingdeeRepMaterialStockResponse[200];
  738 +/**
  739 + * @description
  740 + * listMaterialStock
  741 + * @tags kingdee-erp-controller
  742 + * @produces *
  743 + * @consumes application/json
  744 + */
  745 +export const postKingdeeRepMaterialStock = /* #__PURE__ */ (() => {
  746 + const method = 'post';
  747 + const url = '/kingdee/rep/materialStock';
  748 + function request(
  749 + option: PostKingdeeRepMaterialStockOption,
  750 + ): Promise<PostKingdeeRepMaterialStockResponseSuccess> {
  751 + return requester(request.url, {
  752 + method: request.method,
  753 + ...option,
  754 + }) as unknown as Promise<PostKingdeeRepMaterialStockResponseSuccess>;
609 755 }
610 756  
611 757 /** http method */
... ... @@ -8127,6 +8273,77 @@ export const postServiceOrderUpdateAnnex = /* #__PURE__ */ (() =&gt; {
8127 8273 return request;
8128 8274 })();
8129 8275  
  8276 +/** @description request parameter type for postServiceOrderUpdateHirePurchase */
  8277 +export interface PostServiceOrderUpdateHirePurchaseOption {
  8278 + /**
  8279 + * @description
  8280 + * dto
  8281 + */
  8282 + body: {
  8283 + /**
  8284 + @description
  8285 + dto */
  8286 + dto: Dto;
  8287 + };
  8288 +}
  8289 +
  8290 +/** @description response type for postServiceOrderUpdateHirePurchase */
  8291 +export interface PostServiceOrderUpdateHirePurchaseResponse {
  8292 + /**
  8293 + * @description
  8294 + * OK
  8295 + */
  8296 + 200: ServerResult;
  8297 + /**
  8298 + * @description
  8299 + * Created
  8300 + */
  8301 + 201: any;
  8302 + /**
  8303 + * @description
  8304 + * Unauthorized
  8305 + */
  8306 + 401: any;
  8307 + /**
  8308 + * @description
  8309 + * Forbidden
  8310 + */
  8311 + 403: any;
  8312 + /**
  8313 + * @description
  8314 + * Not Found
  8315 + */
  8316 + 404: any;
  8317 +}
  8318 +
  8319 +export type PostServiceOrderUpdateHirePurchaseResponseSuccess =
  8320 + PostServiceOrderUpdateHirePurchaseResponse[200];
  8321 +/**
  8322 + * @description
  8323 + * 修改分期付款信息
  8324 + * @tags 内部订单
  8325 + * @produces *
  8326 + * @consumes application/json
  8327 + */
  8328 +export const postServiceOrderUpdateHirePurchase = /* #__PURE__ */ (() => {
  8329 + const method = 'post';
  8330 + const url = '/service/order/updateHirePurchase';
  8331 + function request(
  8332 + option: PostServiceOrderUpdateHirePurchaseOption,
  8333 + ): Promise<PostServiceOrderUpdateHirePurchaseResponseSuccess> {
  8334 + return requester(request.url, {
  8335 + method: request.method,
  8336 + ...option,
  8337 + }) as unknown as Promise<PostServiceOrderUpdateHirePurchaseResponseSuccess>;
  8338 + }
  8339 +
  8340 + /** http method */
  8341 + request.method = method;
  8342 + /** request url */
  8343 + request.url = url;
  8344 + return request;
  8345 +})();
  8346 +
8130 8347 /** @description request parameter type for postServiceOrderUpdateOrder */
8131 8348 export interface PostServiceOrderUpdateOrderOption {
8132 8349 /**
... ...