参照UB单创建DN并过账
- *&---------------------------------------------------------------------*
- *& Form FRM_DN_POST
- *&---------------------------------------------------------------------*
- *& text 参照UB单创建DN 并发货过账
- *&---------------------------------------------------------------------*
- *& --> p1 text
- *& <-- p2 text
- *&---------------------------------------------------------------------*
- FORM frm_dn_post .
- DATA:lt_stock_items TYPE TABLE OF bapidlvreftosto.
- DATA:ls_stock_items TYPE bapidlvreftosto.
- DATA:lt_created_items TYPE TABLE OF bapidlvitemcreated.
- DATA:ls_created_items TYPE bapidlvitemcreated.
- DATA:lv_delivery TYPE bapishpdelivnumb-deliv_numb.
- DATA:lv_vstel TYPE vstel.
- DATA:lv_ledat TYPE ledat.
- DATA:lt_return TYPE TABLE OF bapiret2.
- DATA:ls_header_data LIKE bapiobdlvhdrchg.
- DATA:ls_header_ctrl LIKE bapiobdlvhdrctrlchg.
- DATA:lt_item_data LIKE TABLE OF bapiobdlvitemchg.
- DATA:ls_item_data LIKE bapiobdlvitemchg.
- DATA:lt_item_data_spl LIKE TABLE OF /spe/bapiobdlvitemchg.
- DATA:ls_item_data_spl LIKE /spe/bapiobdlvitemchg.
- DATA:lt_item_control LIKE TABLE OF bapiobdlvitemctrlchg.
- DATA:ls_item_control LIKE bapiobdlvitemctrlchg.
- DATA:lt_vbpok_tab TYPE TABLE OF vbpok.
- DATA:ls_vbpok_tab TYPE vbpok.
- DATA:ls_techn_control TYPE bapidlvcontrol.
- DATA:ls_header_control TYPE bapiobdlvhdrctrlchg.
- DATA:ls_vbkok TYPE vbkok.
- DATA:lt_prot TYPE TABLE OF prott.
- DATA:lv_flag TYPE c,
- lv_message TYPE string,
- lv_message1 TYPE string,
- lv_mblnr TYPE mkpf-mblnr,
- lv_mjahr TYPE mkpf-mjahr.
- **取到选中的订单号
- LOOP AT gt_doc ASSIGNING <gf_doc> WHERE sel = 'X' AND zstatus <> 'S'.
- gs_key-ebeln = <gf_doc>-ebeln.
- COLLECT gs_key INTO gt_key.
- ENDLOOP.
- **通过订单号处理
- LOOP AT gt_key INTO gs_key.
- **s1.根据UB创建DN
- **清变量
- CLEAR: lv_message,lv_flag,
- lv_delivery,
- ls_stock_items,lt_stock_items,
- ls_created_items,lt_created_items,
- lt_return.
- **参数赋值
- LOOP AT gt_doc ASSIGNING <gf_doc> WHERE ebeln = gs_key-ebeln.
- ls_stock_items-ref_doc = <gf_doc>-ebeln. "参考凭证
- ls_stock_items-ref_item = <gf_doc>-ebelp."参考项
- APPEND ls_stock_items TO lt_stock_items.
- ls_created_items-ref_doc = <gf_doc>-ebeln. "参考凭证
- ls_created_items-ref_item = <gf_doc>-ebelp."参考项
- ls_created_items-material = <gf_doc>-zmatnr."物料编号
- ls_created_items-material_long = <gf_doc>-zmatnr."物料编号
- APPEND ls_created_items TO lt_created_items.
- ENDLOOP.
- * DATA(lv_flag) = 'Y'.
- * EXPORT lv_flag TO MEMORY ID 'ZPOS_LGORT_FLAG'.
- CALL FUNCTION 'BAPI_OUTB_DELIVERY_CREATE_STO'
- EXPORTING
- ship_point = lv_vstel
- due_date = lv_ledat
- IMPORTING
- delivery = lv_delivery
- TABLES
- stock_trans_items = lt_stock_items
- created_items = lt_created_items
- return = lt_return.
- FREE MEMORY ID 'ZPOS_LGORT_FLAG'.
- DELETE lt_return WHERE type = 'E' AND id = 'BAPI' AND number = ''.
- LOOP AT lt_return INTO DATA(ls_return) WHERE type = 'E'.
- lv_flag = 'E'.
- CONCATENATE lv_message ls_return-message INTO lv_message SEPARATED BY '/'.
- ENDLOOP.
- IF lv_flag = 'E'.
- CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
- LOOP AT gt_doc ASSIGNING <gf_doc> WHERE ebeln = gs_key-ebeln.
- <gf_doc>-cldat = sy-datum.
- <gf_doc>-cltim = sy-uzeit.
- <gf_doc>-clnam = sy-uname.
- * IF lv_flag = 'E'.
- <gf_doc>-zstatus = 'E'.
- <gf_doc>-zmessage = lv_message.
- <gf_doc>-icon = '@5C@'.
- * ELSE.
- * <gf_doc>-zstatus = '1'.
- * <gf_doc>-zmessage = 'DN创建成功'.
- ** <gf_doc>-ICON = '@5B@'.
- * <gf_doc>-vbeln = lv_delivery.
- ** <gf_doc>-posnr = lv_mjahr.
- * ENDIF.
- PERFORM frm_update_db.
- ENDLOOP.
- ELSE.
- CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
- EXPORTING
- wait = 'X'.
- **s2.修改DN
- CLEAR:lv_mblnr,lv_mjahr,
- ls_header_data,ls_header_ctrl,
- ls_item_data,lt_item_data,
- ls_item_data_spl,lt_item_data_spl,
- ls_item_control,lt_item_control.
- **参数赋值
- ls_header_data-deliv_numb = lv_delivery.
- ls_header_ctrl-deliv_numb = lv_delivery.
- **记录DN创建结果
- LOOP AT gt_doc ASSIGNING <gf_doc> WHERE ebeln = gs_key-ebeln.
- <gf_doc>-cldat = sy-datum.
- <gf_doc>-cltim = sy-uzeit.
- <gf_doc>-clnam = sy-uname.
- <gf_doc>-zstatus = ''.
- <gf_doc>-zmessage = 'DN创建成功'.
- ** <gf_doc>-ICON = '@5B@'.
- <gf_doc>-vbeln = lv_delivery.
- DATA: ls_lips LIKE lips.
- **通过VGBEL VGPOS
- CLEAR: ls_lips.
- SELECT SINGLE *"posnr INTO <gf_doc>-posnr
- INTO ls_lips
- FROM lips
- WHERE vgbel = <gf_doc>-ebeln
- AND vgpos = <gf_doc>-ebelp.
- <gf_doc>-posnr = ls_lips-posnr.
- PERFORM frm_update_db.
- **要修改:存储地点 数量 批次
- ls_item_data-deliv_numb = lv_delivery."交货
- ls_item_data-deliv_item = ls_lips-posnr."交货项目
- ls_item_data-material = ls_lips-matnr."物料编号
- ls_item_data-dlv_qty = <gf_doc>-zlfimg."数量
- * ls_item_data-batch = lips-charg."批次
- ls_item_data-fact_unit_nom = ls_lips-umvkz.
- ls_item_data-fact_unit_denom = ls_lips-umvkn.
- APPEND ls_item_data TO lt_item_data.
- CLEAR:ls_item_data.
- ls_item_data_spl-deliv_numb = ls_lips-vbeln."交货单
- ls_item_data_spl-deliv_item = ls_lips-posnr."交货单行项目
- ls_item_data_spl-stge_loc = <gf_doc>-zlgort. "库存地点
- APPEND ls_item_data_spl TO lt_item_data_spl.
- CLEAR:ls_item_data_spl.
- ls_item_control-deliv_numb = ls_lips-vbeln."交货单
- ls_item_control-deliv_item = ls_lips-posnr."交货单行项目
- ls_item_control-chg_delqty = 'X'.
- APPEND ls_item_control TO lt_item_control.
- CLEAR:ls_item_control.
- ENDLOOP.
- IF lt_item_data IS NOT INITIAL.
- CLEAR:lt_return.
- CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
- EXPORTING
- header_data = ls_header_data
- header_control = ls_header_ctrl
- delivery = lv_delivery
- TABLES
- item_data = lt_item_data
- item_data_spl = lt_item_data_spl
- item_control = lt_item_control
- return = lt_return.
- READ TABLE lt_return TRANSPORTING NO FIELDS WITH KEY type = 'E'.
- IF sy-subrc <> .
- CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
- EXPORTING
- wait = 'X'.
- <gf_doc>-zmessage = 'DN修改成功'.
- **记录DN修改结果
- LOOP AT gt_doc ASSIGNING <gf_doc> WHERE ebeln = gs_key-ebeln.
- <gf_doc>-cldat = sy-datum.
- <gf_doc>-cltim = sy-uzeit.
- <gf_doc>-clnam = sy-uname.
- <gf_doc>-zstatus = ''.
- <gf_doc>-zmessage = 'DN修改成功'.
- ** <gf_doc>-ICON = '@5B@'.
- PERFORM frm_update_db.
- ENDLOOP.
- **s3.DN过账
- **清变量
- CLEAR:lv_mblnr,lv_mjahr,
- ls_vbkok,lv_flag,
- lt_prot,
- ls_vbpok_tab,lt_vbpok_tab.
- SELECT *
- FROM lips
- INTO TABLE @DATA(lt_lips)
- WHERE vbeln = @lv_delivery.
- LOOP AT lt_lips ASSIGNING FIELD-SYMBOL(<fs_lips>).
- CLEAR:ls_vbpok_tab.
- ls_vbpok_tab-vbeln_vl = <fs_lips>-vbeln. "交货.
- ls_vbpok_tab-posnr_vl = <fs_lips>-posnr."原行项目
- ls_vbpok_tab-vbeln = <fs_lips>-vbeln. "交货.
- ls_vbpok_tab-posnn = <fs_lips>-posnr."交货项目
- ls_vbpok_tab-matnr = <fs_lips>-matnr."物料编号
- ls_vbpok_tab-charg = <fs_lips>-charg."批号
- ls_vbpok_tab-lfimg = <fs_lips>-lfimg.
- ls_vbpok_tab-meins = <fs_lips>-meins.
- ls_vbpok_tab-werks = <fs_lips>-werks ."库存地点
- ls_vbpok_tab-lgort = . "库存地点
- ls_vbpok_tab-kzlgo = 'X'. "库存地点可修改
- ls_vbpok_tab-pikmg = <fs_lips>-lfimg."捡配数量
- ls_vbpok_tab-lgmng = <fs_lips>-lfimg."交货量
- APPEND ls_vbpok_tab TO lt_vbpok_tab.
- CLEAR:ls_item_data_spl.
- ls_item_data_spl-deliv_numb = <fs_lips>-vbeln."交货
- ls_item_data_spl-deliv_item = <fs_lips>-posnr."原行项目
- ls_item_data_spl-stge_loc = . "库存地点
- APPEND ls_item_data_spl TO lt_item_data_spl.
- ENDLOOP.
- ls_header_data-deliv_numb = lv_delivery."交货
- ls_techn_control-upd_ind = 'U'.
- ls_header_control-deliv_numb = lv_delivery."交货
- lv_delivery = lv_delivery."交货
- ls_vbkok-vbeln_vl = lv_delivery.
- ls_vbkok-wabuc = 'X'.
- ls_vbkok-wadat_ist = sy-datum.
- CALL FUNCTION 'WS_DELIVERY_UPDATE'
- EXPORTING
- vbkok_wa = ls_vbkok
- delivery = lv_delivery
- update_picking = 'X'
- IMPORTING
- ef_error_in_goods_issue_0 = lv_flag
- TABLES
- prot = lt_prot
- vbpok_tab = lt_vbpok_tab
- EXCEPTIONS
- error_message =
- OTHERS = .
- LOOP AT lt_prot INTO DATA(ls_prot) WHERE msgty = 'E'.
- lv_flag = 'E'.
- CLEAR:lv_message1.
- MESSAGE ID ls_prot-msgid
- TYPE ls_prot-msgty
- NUMBER ls_prot-msgno
- WITH ls_prot-msgv1 ls_prot-msgv2 ls_prot-msgv3 ls_prot-msgv4
- INTO lv_message1.
- CONCATENATE lv_message lv_message1 INTO lv_message SEPARATED BY '/'.
- ENDLOOP.
- IF lv_flag = 'E'.
- "创建失败
- CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
- **状态跟新+回写落地表
- LOOP AT gt_doc ASSIGNING <gf_doc> WHERE ebeln = gs_key-ebeln.
- <gf_doc>-cldat = sy-datum.
- <gf_doc>-cltim = sy-uzeit.
- <gf_doc>-clnam = sy-uname.
- <gf_doc>-zstatus = 'E'.
- <gf_doc>-zmessage = 'DN过账失败:' && lv_message.
- <gf_doc>-icon = '@5C@'.
- PERFORM frm_update_db.
- ENDLOOP.
- ELSE.
- "创建成功
- CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
- EXPORTING
- wait = 'X'.
- SELECT SINGLE mblnr mjahr INTO (lv_mblnr,lv_mjahr)
- FROM mseg WHERE vbeln_im = lv_delivery.
- LOOP AT gt_doc ASSIGNING <gf_doc> WHERE ebeln = gs_key-ebeln.
- <gf_doc>-cldat = sy-datum.
- <gf_doc>-cltim = sy-uzeit.
- <gf_doc>-clnam = sy-uname.
- <gf_doc>-mblnr = lv_mblnr.
- <gf_doc>-mjahr = lv_mjahr.
- <gf_doc>-zstatus = 'S'.
- <gf_doc>-zdjzt = 'X'.
- * <gf_doc>-zmessage = 'DN过账失败:' && lv_message.
- <gf_doc>-icon = '@5B@'.
- PERFORM frm_update_db.
- ENDLOOP.
- ENDIF.
- ***状态跟新+回写落地表
- * LOOP AT gt_doc ASSIGNING <gf_doc> WHERE ebeln = gs_key-ebeln.
- * <gf_doc>-cldat = sy-datum.
- * <gf_doc>-cltim = sy-uzeit.
- * <gf_doc>-clnam = sy-uname.
- * IF lv_flag = 'E'.
- * <gf_doc>-zstatus = 'E'.
- * <gf_doc>-zmessage = 'DN过账失败:' && lv_message.
- * <gf_doc>-icon = '@5C@'.
- * ELSE.
- * <gf_doc>-zstatus = 'S'.
- * <gf_doc>-zmessage = 'DN过账成功'.
- * <gf_doc>-icon = '@5B@'.
- ***怎么取凭证号
- * <gf_doc>-mblnr = lv_delivery.
- * <gf_doc>-mjahr = lv_mjahr.
- * ENDIF.
- *
- * PERFORM frm_update_db.
- *
- * ENDLOOP.
- ELSE.
- "修改失败
- CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
- <gf_doc>-zmessage = '交货单修改失败'.
- ENDIF.
- ENDIF.
- ENDIF.
- ENDLOOP.
- * "获取采购订单数据-行项目数据
- * SELECT *
- * FROM ekpo
- * INTO TABLE @DATA(lt_ekpo)
- * WHERE ebeln = @iv_ebeln."采购订单
- * LOOP AT lt_ekpo INTO DATA(ls_ekpo).
- *
- * ls_stock_items-ref_doc = ls_ekpo-ebeln."参考凭证
- * ls_stock_items-ref_item = ls_ekpo-ebelp."参考项
- * APPEND ls_stock_items TO lt_stock_items.
- * ls_created_items-ref_doc = ls_ekpo-ebeln."参考凭证
- * ls_created_items-ref_item = ls_ekpo-ebelp."参考项
- * ls_created_items-material = ls_ekpo-matnr."物料编号
- * ls_created_items-material_long = ls_ekpo-matnr."物料编号
- * APPEND ls_created_items TO lt_created_items.
- * ENDLOOP.
- *
- ** DATA(lv_flag) = 'Y'.
- ** EXPORT lv_flag TO MEMORY ID 'ZPOS_LGORT_FLAG'.
- * CALL FUNCTION 'BAPI_OUTB_DELIVERY_CREATE_STO'
- * EXPORTING
- * ship_point = lv_vstel
- * due_date = lv_ledat
- * IMPORTING
- * delivery = lv_delivery
- * TABLES
- * stock_trans_items = lt_stock_items
- * created_items = lt_created_items
- * return = lt_return.
- * FREE MEMORY ID 'ZPOS_LGORT_FLAG'.
- *
- * DELETE lt_return WHERE type = 'E' AND id = 'BAPI' AND number = '001'.
- *
- * LOOP AT lt_return INTO DATA(ls_return) WHERE type = 'E'.
- * CONCATENATE o_return-message ls_return-message INTO o_return-message SEPARATED BY '/'.
- * ENDLOOP.
- *
- * IF sy-subrc = 0.
- *
- * "创建失败
- * CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
- *
- * o_return-type = 'E'.
- * CONCATENATE '交货单创建失败:' o_return-message INTO o_return-message.
- *
- * ELSE.
- *
- * "创建成功
- * CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
- * EXPORTING
- * wait = 'X'.
- *
- * o_return-zdjh = lv_delivery."交货单
- * o_return-type = 'S'.
- * o_return-message = '交货单创建成功'.
- *
- * ls_header_data-deliv_numb = lv_delivery.
- * ls_header_ctrl-deliv_numb = lv_delivery.
- *
- * SELECT *
- * FROM lips
- * INTO TABLE @DATA(lt_lips)
- * WHERE vbeln = @lv_delivery.
- *
- * LOOP AT lt_lips INTO DATA(ls_lips).
- * ls_item_data-deliv_numb = ls_lips-vbeln."交货
- * ls_item_data-deliv_item = ls_lips-posnr."交货项目
- * ls_item_data-material = ls_lips-matnr."物料编号
- * ls_item_data-dlv_qty = ''."越库业务:创建DN时,数量都变为0
- * ls_item_data-fact_unit_nom = ls_lips-umvkz.
- * ls_item_data-fact_unit_denom = ls_lips-umvkn.
- * APPEND ls_item_data TO lt_item_data.
- * CLEAR:ls_item_data.
- *
- * ls_item_data_spl-deliv_numb = ls_lips-vbeln."交货单
- * ls_item_data_spl-deliv_item = ls_lips-posnr."交货单行项目
- * ls_item_data_spl-stge_loc = ls_lips-lgort. "库存地点
- * APPEND ls_item_data_spl TO lt_item_data_spl.
- * CLEAR:ls_item_data_spl.
- *
- * ls_item_control-deliv_numb = ls_lips-vbeln."交货单
- * ls_item_control-deliv_item = ls_lips-posnr."交货单行项目
- * ls_item_control-chg_delqty = 'X'.
- * APPEND ls_item_control TO lt_item_control.
- * CLEAR:ls_item_control.
- *
- * ENDLOOP.
- *
- * IF lt_item_data IS NOT INITIAL.
- * CLEAR:lt_return.
- *
- * CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
- * EXPORTING
- * header_data = ls_header_data
- * header_control = ls_header_ctrl
- * delivery = lv_delivery
- * TABLES
- * item_data = lt_item_data
- * item_data_spl = lt_item_data_spl
- * item_control = lt_item_control
- * return = lt_return.
- *
- * READ TABLE lt_return TRANSPORTING NO FIELDS WITH KEY type = 'E'.
- * IF sy-subrc <> 0.
- * CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
- * EXPORTING
- * wait = 'X'.
- * o_return-message = '交货单创建成功/交货单修改成功'.
- * ELSE.
- * "修改失败
- * CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
- * o_return-message = '交货单创建成功/交货单修改失败'.
- * ENDIF.
- *
- * ENDIF.
- *
- * ENDIF.
- ENDFORM.
参照UB单创建DN并过账的更多相关文章
- UB单修改
FUNCTION Z_SD_UB_CHANGE. *"-------------------------------------------------------------------- ...
- 用dedecms自定义表单创建简易自助预约系统
建站往往需要根据客户的需求来增加相应的功能,比如预约.平时用比较多的是织梦系统,那么如何用dedecms自定义表单创建简易自助预约系统呢? 进入dedecms后台,左侧菜单中依次点击“核心” - 频道 ...
- 雷林鹏分享:jQuery EasyUI 表单 - 创建异步提交表单
jQuery EasyUI 表单 - 创建异步提交表单 本教程向您展示如何通过 easyui 提交一个表单(Form).我们创建一个带有 name.email 和 phone 字段的表单.通过使用 e ...
- 雷林鹏分享:jQuery EasyUI 表单 - 创建树形下拉框
jQuery EasyUI 表单 - 创建树形下拉框 树形下拉框(ComboTree)是一个带有下列树形结构(Tree)的下拉框(ComboBox).它可以作为一个表单字段进行使用,可以提交给远程服务 ...
- Flask基础(16)-->WTForms表单创建和简单验证
Flask基础(16)-->WTForms表单创建和简单验证 前言:使用Flask_WTF需要配置参数SECRET_KEYCSRF_ENABLED是为了CSRF(跨站请求伪造)保护.SECRET ...
- django搭建BBS-表单创建&注册
django搭建BBS-表单创建&注册 0824自我总结 文件结构 app 接口 migrations __inint__.py admin.py 管理员页面注册表单用 apps.py bbs ...
- activiti自定义流程之整合(三):整合自定义表单创建模型
本来在创建了表单之后应该是表单列表和预览功能,但是我看了看整合的代码,和之前没有用angularjs的基本没有什么变化,一些极小的变动也只是基于angularjs的语法,因此完全可以参考之前说些的表单 ...
- php入门之表单创建和基本处理
为了方便后面学习数组,这里引入了过渡章节就是表单,至于为什么,等真的学习到数组的时候你就会发现它的妙处拉. ============================================== ...
- WPF仿网易云音乐系列(二、歌单创建窗口+登录设置模块)
老衲牺牲午休时间写博客,都快把自己感动了,-_-!! 之前上一篇随笔,我看了下评论,有部分人说WPF已经凉凉了,这个我觉得,这只是一个达到自己目的的工具而已,只要自己能用这个工具,得心应手的做出自己想 ...
随机推荐
- 库克谈新iPhone不支持5G的理由,学习一下如何高手怎么应答
库克谈新iPhone不支持5G的理由 投递人 itwriter 发布于 2019-09-12 08:41 评论(14) 有1623人阅读 原文链接 [收藏] « » 9 月 12 日消息,苹果公司 C ...
- php高精度计算
- CDN加速地址URL拿不到,显示“无法访问此网站”
问题:CDN加速地址URL拿不到,显示“无法访问此网站” 原因:浏览器缓冲原因,导致拿到的content-encoding不是一个标准的值 解决方法: 1. 客户机器 ping一下访问的CDN加速域名 ...
- .net 后台页面统一验证是否登录
首先新写一个PageBase类 using System; using System.Collections.Generic; using System.Web; namespace Departme ...
- 第107题:二叉树的层次遍历II
一. 问题描述 给定一个二叉树,返回其节点值自底向上的层次遍历. (即按从叶子节点所在层到根节点所在的层,逐层从左向右遍历) 例如: 给定二叉树 [3,9,20,null,null,15,7], 3 ...
- http文件服务器上传与下载功能
https://www.cnblogs.com/liferecord/p/4843615.html
- Ellipsis对象
Ellipsis对象. 写作 : ‘…’ 中文解释:省略 该对象bool测试是为真 用途: 1.用来省略代码,作用类似于pass的一种替代方案,这是python的’TBD’(未确定内容). def f ...
- MySQL5.7 (审计)安装audit审计插件
转载自:https://blog.51cto.com/13941177/2173086 注意: 安装插件的方式优缺点: 缺点:日志信息比较大,对性能影响大. 优点:对每一时刻每一用户的操作都有记录. ...
- python 序列通用操作
通用序列操作:索引:greeting=hellogreeting[0] 分片:number[1,2,3,4,5,6]number[3:6]number[3:6:1] 序列相加:[1,2,3] + [4 ...
- 洛谷P1860 新魔法药水
洛谷题目链接 动态规划: 这个题目调了我好久....结果循环变量写错了... 而且题目有个坑!!!只能用开始给你的$v$元买入东西 回归正题: 我们定义状态$ans[i][j]$表示第$i$个物品用了 ...