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’
})
}