|
@@ -766,7 +766,32 @@ func (rg *PreRegisterController) Del(c *gin.Context) {
|
|
|
resp.FailMsg("删除统计记录失败", "Err:"+e.Error(), c)
|
|
|
return
|
|
|
}
|
|
|
- //todo 合同看情况要不要删
|
|
|
+ //删除预登记新增的假合同
|
|
|
+ count, e := fms.GetInvoiceCountByRegisterId(req.ContractRegisterId)
|
|
|
+ if e != nil {
|
|
|
+ resp.FailMsg("删除统计记录失败", "Err:"+e.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if count == 0{
|
|
|
+ ob := new(fms.ContractRegister)
|
|
|
+ item, e := ob.Fetch(req.ContractRegisterId)
|
|
|
+ if e != nil {
|
|
|
+ if e == utils.ErrNoRow {
|
|
|
+ resp.Fail("合同登记不存在或已被删除", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp.FailMsg("获取合同登记失败", "Err:"+e.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ nowTime := time.Now().Local()
|
|
|
+ item.IsDeleted = 1
|
|
|
+ item.ModifyTime = nowTime
|
|
|
+ updateCols := []string{"IsDeleted", "ModifyTime"}
|
|
|
+ if e = item.Update(updateCols); e != nil {
|
|
|
+ resp.FailMsg("操作失败", "更新合同登记失败, Err:"+e.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
resp.Ok("操作成功", c)
|
|
|
}
|