|
|
@@ -188,20 +188,31 @@ func (this *SupplierfileController) AddSubfile() {
|
|
|
var list []supplierfile.OilSupplierFile
|
|
|
where := "SupplierId = '" + strconv.Itoa(model.SupplierId) + "'"
|
|
|
svc.GetEntitysByWhere(OilSupplierFileName, where, &list)
|
|
|
- hasField := ""
|
|
|
+ //hasField := ""
|
|
|
+ var errinfo ErrorDataInfo
|
|
|
for i := 0; i < len(list); i++ {
|
|
|
- hasField += list[i].NeedFileType + ","
|
|
|
+ //hasField += list[i].NeedFileType + ","
|
|
|
+ if list[i].NeedFileType == model.NeedFileType && list[i].SupplierTypeCode == model.SupplierTypeCode {
|
|
|
+ //已存在,不能重复添加
|
|
|
+ errinfo.Message = "操作失败!不能重复添加"
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- var errinfo ErrorDataInfo
|
|
|
- if strings.Contains(hasField, model.NeedFileType+",") {
|
|
|
- //已存在,不能重复添加
|
|
|
- errinfo.Message = "操作失败!不能重复添加"
|
|
|
- errinfo.Code = -1
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- return
|
|
|
- }
|
|
|
+
|
|
|
+ //if strings.Contains(hasField, model.NeedFileType+",") {
|
|
|
+ // if model.SupplierTypeCode != "000" {
|
|
|
+ // //已存在,不能重复添加
|
|
|
+ // errinfo.Message = "操作失败!不能重复添加"
|
|
|
+ // errinfo.Code = -1
|
|
|
+ // this.Data["json"] = &errinfo
|
|
|
+ // this.ServeJSON()
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
_, err := svc.InsertEntityBytbl(OilSupplierFileName, &model)
|
|
|
if err == nil {
|