Explorar o código

三级单位的地点台账

yuedefeng %!s(int64=6) %!d(string=hai) anos
pai
achega
414a81cc3b

+ 10 - 2
src/dashoo.cn/backend/api/controllers/lims/Limscustomerposition.go

@@ -109,7 +109,7 @@ func (this *LimsCustomerpositionController) GetEntityList() {
 	if ModifiedBy != "" {
 		where = where + " and ModifiedBy like '%" + ModifiedBy + "%'"
 	}
-	
+
 	if this.User.UintThirdId > 0 {
 		where = where + " and ThrUnitId = '" + strconv.Itoa(this.User.UintThirdId) + "'"
 	}
@@ -240,7 +240,15 @@ func (this *LimsCustomerpositionController) AddEntity() {
 	model.CreateBy = this.User.Realname
 	model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
 	//model.OrganizeId, _ = utils.StrTo(this.User.DepartmentId).Int()
-
+	if model.PositionTypeId == "2" {
+		// 说明是安装位置,需要获取父亲节点的三级单位
+		var parentItem limscustomerposition.LimsCustomerPosition
+		svc.GetEntityByWhere(this.User.AccCode + LimsCustomerpositionName, "Id = '" + strconv.Itoa(model.ParentId) +"'", &parentItem)
+		if parentItem.ThrUnitId > 0 {
+			model.ThrUnitId = parentItem.ThrUnitId
+			model.ThrUnit = parentItem.ThrUnit
+		}
+	}
 	_, err := svc.InsertEntityBytbl(this.User.AccCode+LimsCustomerpositionName, &model)
 
 	var errinfo ErrorDataInfo