csharp‘ 批量添加的操作

csharp’ 批量添加的操作

    /// <summary>
        /// 添加配套料管理
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [ActionPermissionFilter(Permission = "plan:bnestmatmanage:add")]
        [Log(Title = "配套料管理", BusinessType = BusinessType.INSERT)]
        public IActionResult AddBNestmatManage([FromBody] BNestmatManageDto parm)
        {
            if (parm == null)

            {
                throw new CustomException("请求参数错误");
            }
            List<BNestmatManage> modals = new List<BNestmatManage>();
            var modal = parm.Adapt<BNestmatManage>().ToCreate(HttpContext);

          
            var response = _BNestmatManageService.AddBNestmatManage(modal,parm.Columns);

            return ToResponse(response);
        }

    /** 保存清单操作 */
    saveLists() {
      this.order_nums()
      const mainTable = Object.assign({
        empCode: this.$store.getters.userId,
        omStatus: 0,
        orderNo: this.orderNum,
        listNo: this.outTradeNo,
      })
      mainTable.Columns = this.fliterproduct // 过滤出来的数据列表
      if (this.fliterproduct.length != mainTable.Columns.length) {
        this.msgError('有项未完成,请完成所有项后保存')
        return
      }
      addBNestmatManage(mainTable)
        .then((res) => {
          this.msgSuccess('保存成功')
        })
        .catch((err) => {
          //TODO 错误逻辑
        })
    },

//接口
  public interface IBNestmatManageService : IBaseService<BNestmatManage>
    {
        int AddBNestmatManage(BNestmatManage parm,List<BNestmatManage> rows);
    }

    /// <summary>
        /// 添加配套料管理
        /// </summary>
        /// <param name="parm"></param>
        /// <returns></returns>
        public int AddBNestmatManage(BNestmatManage parm, List<BNestmatManage> rows)
        {

            foreach (var item in rows)
            {
                item.OmStatus = parm.OmStatus;
                item.EmpCode = parm.EmpCode;
                item.OrderNo = parm.OrderNo;
                item.ListNo = parm.ListNo;
            }
            var response = _BNestmatManageRepository.Insert(rows);
            return response;
        }


csharp批量删除的操作

   /// <summary>
        /// 删除配套料管理  根据某一字段全部删除
        /// </summary>
        /// <returns></returns>
        [HttpDelete("{ids}")]
        [ActionPermissionFilter(Permission = "plan:bnestmatmanage:delete")]
        [Log(Title = "配套料管理", BusinessType = BusinessType.DELETE)]
        public IActionResult DeleteBNestmatManage(string ids)
        {
          
            List<BNestmatManage> list = new List<BNestmatManage>() { new BNestmatManage() { ListNo = ids} };
            var response =_BNestmatManageService.Deleteable().Where(it=>it.ListNo== ids).ExecuteCommand();

            return ToResponse(response);
        }

csharp批量修改的操作

   ///指定更新某个字段
  
        [HttpPut("{ListNo}")]
        [ActionPermissionFilter(Permission = "plan:bnestmatmanage:edit")]
        [Log(Title = "配套料管理", BusinessType = BusinessType.UPDATE)]
        public IActionResult Check(string ListNo)
        {
       
            List<BNestmatManage> res = new List<BNestmatManage>();
            res = _BNestmatManageService.GetList(w => w.ListNo == ListNo).ToList();
            int?[] ids = res.Select(it=>it.Id).ToArray();
            var result71 = _BNestmatManageService.UpdateCheck(ids);

            return ToResponse(result71);
        }
//接口
 public interface IBNestmatManageService : IBaseService<BNestmatManage>
    {
        int UpdateCheck(int?[] parm);

    }
   /// <summary>
        /// 修改配套料管理
        /// </summary>
        /// <param name="parm"></param>
        /// <returns></returns>s
        public int UpdateCheck(int?[] ids)
        {
            var response = _BNestmatManageRepository.Context.Updateable<BNestmatManage>()
                //_BNestmatManageRepository.Context  相当与官网中的db语句
             .SetColumns(it => it.OmStatus == 1)
             .Where(it => ids.Contains(it.Id)).ExecuteCommand();

            return response;
        }



/**

  • 新增配套料管理
  • @param data
    */
    export function addBNestmatManage(data) {
    return request({
    url: ‘plan/BNestmatManage’,
    method: ‘post’,
    data: data ,
    })
    }

/**

  • 新增配套料管理
  • @param data
    */
    export function addBNestmatManage(data) {
    return request({
    url: ‘plan/BNestmatManage’,
    method: ‘post’,
    data: data ,
    })
    }

/**

  • 修改配套料管理
  • @param data
    */
    export function updateBNestmatManage(data) {
    return request({
    url: ‘plan/BNestmatManage’,
    method: ‘PUT’,
    data: data ,
    })
    }
    //审核

export function checkStates(ListNo) {
return request({
url: ‘plan/BNestmatManage/’ + ListNo,
method: ‘put’,
})
}
/**

  • 删除配套料管理
    *@param {主键} pid
    */
    export function delBNestmatManage(pid) {
    return request({
    url: ‘plan/BNestmatManage/’ + pid,
    method: ‘delete’
    })
    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

是貔貅喔

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值