|
@@ -1,7 +1,9 @@
|
|
|
package tmpzcgf
|
|
package tmpzcgf
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
|
+ "dashoo.cn/backend/api/business/oilsupplier/goodsaptitudeclass"
|
|
|
"fmt"
|
|
"fmt"
|
|
|
|
|
+ "strconv"
|
|
|
"time"
|
|
"time"
|
|
|
|
|
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/infochange"
|
|
"dashoo.cn/backend/api/business/oilsupplier/infochange"
|
|
@@ -666,50 +668,39 @@ func (this *TmpzcgfController) CapacityExpansion() {
|
|
|
fmt.Println("==========编码扩充开始=========")
|
|
fmt.Println("==========编码扩充开始=========")
|
|
|
t := time.Now()
|
|
t := time.Now()
|
|
|
|
|
|
|
|
- //svc := supplier.GetOilSupplierService(utils.DBE)
|
|
|
|
|
- //var suppliercertList []suppliercert.OilSupplierCert
|
|
|
|
|
- //where := "SupplierTypeCode='01' and InFlag != '3' "
|
|
|
|
|
- //svc.GetEntities(&suppliercertList, where)
|
|
|
|
|
-
|
|
|
|
|
|
|
+ svc := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
|
|
|
// 供应商
|
|
// 供应商
|
|
|
- //for _, suppliercert := range suppliercertList {
|
|
|
|
|
- // var supplierCertSubList []suppliercertsub.OilSupplierCertSub
|
|
|
|
|
- // wheresup := "SupplierId = " + strconv.Itoa(suppliercert.SupplierId) + " and SupplierTypeCode='01' and LENGTH(CODE) != 8 "
|
|
|
|
|
- // svc.GetEntities(&supplierCertSubList, wheresup)
|
|
|
|
|
- // // 准入项
|
|
|
|
|
- // for _, supplierCertSub := range supplierCertSubList {
|
|
|
|
|
- // var goodsAptitudeClassList []goodsaptitudeclass.OilGoodsAptitudeClass
|
|
|
|
|
- // whereclass := "Code like '" + supplierCertSub.Code + "%' and LENGTH(CODE) = 8"
|
|
|
|
|
- // svc.GetEntities(&goodsAptitudeClassList, whereclass)
|
|
|
|
|
- //
|
|
|
|
|
- // for _, goodsAptitudeClass := range goodsAptitudeClassList {
|
|
|
|
|
- // var entity suppliercertsub.OilSupplierCertSub
|
|
|
|
|
- // entity.SupplierId = supplierCertSub.SupplierId
|
|
|
|
|
- // entity.SupplierCertId = supplierCertSub.SupplierCertId
|
|
|
|
|
- // entity.SupplierTypeCode = supplierCertSub.SupplierTypeCode
|
|
|
|
|
- // entity.AppendStatus = supplierCertSub.AppendStatus
|
|
|
|
|
- // entity.Type = supplierCertSub.Type
|
|
|
|
|
- // entity.Name = goodsAptitudeClass.Name
|
|
|
|
|
- // entity.Code = goodsAptitudeClass.Code
|
|
|
|
|
- // entity.CertSubStatus = supplierCertSub.CertSubStatus
|
|
|
|
|
- // entity.Remark = "编码扩充"
|
|
|
|
|
- // svc.InsertEntityBytbl(OilSupplierCertSubName, &entity)
|
|
|
|
|
- // }
|
|
|
|
|
- //
|
|
|
|
|
- // wheredel := "Id = " + strconv.Itoa(supplierCertSub.Id)
|
|
|
|
|
- // svc.DeleteEntityBytbl(OilSupplierCertSubName, wheredel)
|
|
|
|
|
- //
|
|
|
|
|
- // }
|
|
|
|
|
- //
|
|
|
|
|
- //}
|
|
|
|
|
- svc := tmpzcgf.GetTmpzcgtService(utils.DBE)
|
|
|
|
|
- err := svc.UpdateOilSupplierCertSub()
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- // session.Rollback()
|
|
|
|
|
- fmt.Println(err)
|
|
|
|
|
|
|
+ var supplierCertSubList []suppliercertsub.OilSupplierCertSub
|
|
|
|
|
+ wheresup := " SupplierTypeCode='01' and LENGTH(CODE) != 8 "
|
|
|
|
|
+ svc.GetEntities(&supplierCertSubList, wheresup)
|
|
|
|
|
+ // 准入项
|
|
|
|
|
+ for _, supplierCertSub := range supplierCertSubList {
|
|
|
|
|
+ var goodsAptitudeClassList []goodsaptitudeclass.OilGoodsAptitudeClass
|
|
|
|
|
+ whereclass := "Code like '" + supplierCertSub.Code + "%' and LENGTH(CODE) = 8"
|
|
|
|
|
+ svc.GetEntities(&goodsAptitudeClassList, whereclass)
|
|
|
|
|
+
|
|
|
|
|
+ // 扩充的编码
|
|
|
|
|
+ for _, goodsAptitudeClass := range goodsAptitudeClassList {
|
|
|
|
|
+ var entity suppliercertsub.OilSupplierCertSub
|
|
|
|
|
+ entity.SupplierId = supplierCertSub.SupplierId
|
|
|
|
|
+ entity.SupplierCertId = supplierCertSub.SupplierCertId
|
|
|
|
|
+ entity.SupplierTypeCode = supplierCertSub.SupplierTypeCode
|
|
|
|
|
+ entity.AppendStatus = supplierCertSub.AppendStatus
|
|
|
|
|
+ entity.Type = supplierCertSub.Type
|
|
|
|
|
+ entity.Name = goodsAptitudeClass.Name
|
|
|
|
|
+ entity.Code = goodsAptitudeClass.Code
|
|
|
|
|
+ entity.CertSubStatus = supplierCertSub.CertSubStatus
|
|
|
|
|
+ entity.Remark = "编码扩充"
|
|
|
|
|
+ svc.InsertEntityBytbl(OilSupplierCertSubName, &entity)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ wheredel := "Id = " + strconv.Itoa(supplierCertSub.Id)
|
|
|
|
|
+ svc.DeleteEntityBytbl(OilSupplierCertSubName, wheredel)
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
elapsed := time.Since(t)
|
|
elapsed := time.Since(t)
|
|
|
|
|
+ fmt.Println(elapsed)
|
|
|
fmt.Println("==========编码扩充完成=========", t, elapsed)
|
|
fmt.Println("==========编码扩充完成=========", t, elapsed)
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -873,9 +864,9 @@ func (this *TmpzcgfController) InsertAll() {
|
|
|
this.InsertOilSupplierCertAppend()
|
|
this.InsertOilSupplierCertAppend()
|
|
|
this.UpdateOilSupplierCertAppend()
|
|
this.UpdateOilSupplierCertAppend()
|
|
|
this.InsertOilSupplierCertSub() //插入增项的准入范围
|
|
this.InsertOilSupplierCertSub() //插入增项的准入范围
|
|
|
- //this.UpdateCertSubIsType1() // 更新增项的准入范围 在插入调用了
|
|
|
|
|
|
|
+ this.UpdateCertSubIsType1() // 更新增项的准入范围
|
|
|
|
|
|
|
|
- //this.CapacityExpansion() // 编码扩充 在插入调用了
|
|
|
|
|
|
|
+ this.CapacityExpansion() // 编码扩充
|
|
|
// 历史数据导入-由于运行到此处中断,上面的代码临时注释
|
|
// 历史数据导入-由于运行到此处中断,上面的代码临时注释
|
|
|
// this.UpdateCertSubIsType3() // 更新增项的准入范围 弃用 2020年11月26日
|
|
// this.UpdateCertSubIsType3() // 更新增项的准入范围 弃用 2020年11月26日
|
|
|
this.InsterAnnualAudit()
|
|
this.InsterAnnualAudit()
|