| | |
| | | .IgnoreColumns(true).ExecuteCommand() > 0; |
| | | |
| | | //批量插入忽略空字段 |
| | | var baOrUpdate = db.Insertable(mesWomcabs).PageSize(1) |
| | | var baOrUpdate = db.Insertable(mesWomcabs).PageSize(10) |
| | | .IgnoreColumnsNull() |
| | | .ExecuteCommand() > 0; |
| | | |
| | | if (orUpdate && baOrUpdate) return true; |
| | | if (orUpdate && baOrUpdate) |
| | | { |
| | | //定义输入参数 |
| | | var inputParam1 = new SugarParameter("P_WORK_NO", mesWomcaa.Caa001); |
| | | // 定义输出参数 |
| | | var outParam1 = new SugarParameter("c_Result", null, true); |
| | | var outParam2 = new SugarParameter("C_MSG", null, true); |
| | | // 使用 SqlSugar 执行存储过程 |
| | | Db.Ado.ExecuteCommand( |
| | | "BEGIN PRC_UPDATE_DAA2(:P_WORK_NO,:c_Result,:C_MSG); END;", |
| | | inputParam1, outParam1, outParam2); |
| | | // 获取输出参数的值 |
| | | var result = int.Parse((string)outParam1.Value); |
| | | var message = outParam2.Value == DBNull.Value |
| | | ? string.Empty |
| | | : (string)outParam2.Value; |
| | | if (result == 1) |
| | | { |
| | | //存储过程失败则事务进行回滚 |
| | | db.Ado.RollbackTran(); |
| | | throw new Exception(message); |
| | | } |
| | | |
| | | // 提交事务 |
| | | db.Ado.CommitTran(); |
| | | return true; |
| | | } |
| | | throw new NotImplementedException("插入或更新失败"); |
| | | } |
| | | |
| | | private bool UpdateData(SqlSugarScope db, Womcaa mesWomcaa, |
| | | List<Womcab> mesWomcabs) |
| | | { |
| | | |
| | | |
| | | |
| | | |
| | | var decimals = mesWomcabs.Select(s => s.Id).ToArray(); |
| | | var update = base.DeleteById(mesWomcaa.Id); |
| | | var insertOrUpdate = db |
| | | .Deleteable<Womcab>().In(decimals) |
| | | .ExecuteCommand() > 0; |
| | | |
| | | var update = true; |
| | | if (mesWomcaa != null) |
| | | { |
| | | if (mesWomcaa.Id != null) |
| | | { |
| | | update = base.DeleteById(mesWomcaa.Id); |
| | | } |
| | | } |
| | | var insertOrUpdate = true; |
| | | if (decimals != null || decimals.Length > 0) |
| | | { |
| | | insertOrUpdate = db.Deleteable<Womcab>().In(decimals).ExecuteCommand() > 0; |
| | | } |
| | | |
| | | if (update && insertOrUpdate) return true; |
| | | if (update && insertOrUpdate) |
| | | { |
| | | //定义输入参数 |
| | | var inputParam1 = new SugarParameter("P_WORK_NO", mesWomcaa.Caa001); |
| | | // 定义输出参数 |
| | | var outParam1 = new SugarParameter("c_Result", null, true); |
| | | var outParam2 = new SugarParameter("C_MSG", null, true); |
| | | // 使用 SqlSugar 执行存储过程 |
| | | Db.Ado.ExecuteCommand( |
| | | "BEGIN PRC_UPDATE_DAA2(:P_WORK_NO,:c_Result,:C_MSG); END;", |
| | | inputParam1, outParam1, outParam2); |
| | | // 获取输出参数的值 |
| | | var result = int.Parse((string)outParam1.Value); |
| | | var message = outParam2.Value == DBNull.Value |
| | | ? string.Empty |
| | | : (string)outParam2.Value; |
| | | if (result == 1) |
| | | { |
| | | //存储过程失败则事务进行回滚 |
| | | db.Ado.RollbackTran(); |
| | | throw new Exception(message); |
| | | } |
| | | |
| | | // 提交事务 |
| | | db.Ado.CommitTran(); |
| | | return true; |
| | | } |
| | | throw new NotImplementedException("更新失败"); |
| | | |
| | | } |
| | | |
| | | private Womcaa MapErpCAAtoWomcaa(ErpCAA dto) |
| | |
| | | Typea = dto.TypeA, /// 单据状态 |
| | | RkOrg = dto.RK_ORG, //入库组织 |
| | | Rcn=dto.RCN, //日产能 |
| | | |
| | | |
| | | Cglineid=dto.CG_LINE_ID, //采购订单行id |
| | | Kh=dto.KH, |
| | | Khjc=dto.KH_JCZL, |
| | | Scph=dto.SC_PH, |
| | | Moldno=dto.MOLd_no, |
| | | Oldmoldno=dto.Old_mold_no, |
| | | Jt=dto.JT, |
| | | Xscn=dto.XS_CN, |
| | | Sjxs=dto.SJ_xs, |
| | | Nextgx=dto.NEXT_Gx, |
| | | Rks=dto.RKS, |
| | | //沃尔新增 |
| | | // WR_F_SCDD_SCTZD = dto.F_SCDD_SCTZD |
| | | //WR_F_SCDD_XH = dto.F_SCDD_XH |
| | |
| | | // Db.Deleteable<Womcab>().Where(s => s.Erpid == womcab.Erpid).ExecuteCommand(); |
| | | womcab.Id = entity.Id; |
| | | } |
| | | |
| | | womcabList.Add(womcab); |
| | | } |
| | | |