|
|
@@ -24,6 +24,7 @@ import (
|
|
|
|
|
|
. "dashoo.cn/backend/api/controllers"
|
|
|
"dashoo.cn/utils"
|
|
|
+ myorganize "dashoo.cn/backend/api/business/organize"
|
|
|
)
|
|
|
|
|
|
type LimsEnturstController struct {
|
|
|
@@ -271,13 +272,31 @@ func (this *LimsEnturstController) AddEntrust() {
|
|
|
// if err == nil {
|
|
|
// this.AddSampleType(strconv.Itoa(model.Id), SampleCode)
|
|
|
// }
|
|
|
+
|
|
|
+ orgSvc := myorganize.GetOrganizeService(utils.DBE)
|
|
|
+ positionSvc := limscustomerposition.GetLimsCustomerpositionService(utils.DBE)
|
|
|
+ orgEntityList := orgSvc.GetAllThirdChildByTopId(strconv.Itoa(this.User.UnitId), this.User.Id)
|
|
|
+ //取消3级单位ID列表
|
|
|
+ thrOrgList := ""
|
|
|
+ strPositionList := ""
|
|
|
+ for _, orgValue := range orgEntityList {
|
|
|
+ thrOrgList += strconv.Itoa(orgValue.Id) + ","
|
|
|
+ }
|
|
|
+ thrOrgList += "0"
|
|
|
+ var entitys []limscustomerposition.LimsCustomerPosition
|
|
|
+ entitys = positionSvc.GetPositionCheckList(this.User.AccCode+LimsCustomerpositionName, thrOrgList)
|
|
|
+ for _, value := range entitys {
|
|
|
+ strPositionList += strconv.Itoa(value.Id) + ","
|
|
|
+ }
|
|
|
+ strPositionList += "0"
|
|
|
+
|
|
|
// 保存设备明细
|
|
|
queryCheckDate := this.GetString("querycheckdate")
|
|
|
insertEquipmentSQL := "INSERT INTO " + this.User.AccCode + LimsEntrustEquipmentName
|
|
|
insertEquipmentSQL += "(Entrustmainid, Departmentid, Departmentname, Orderno, Positioncheckid, Positioncheck, Positionid, Position, Custno, DeviceId, Devicename, Templatetypeid, Templatetypename, Spec, Specid, Manufacturer, Status, Remark, CreateOn, CreateUserId, CreateBy)"
|
|
|
insertEquipmentSQL += " SELECT '" + strconv.Itoa(model.Id) + "' as EntrustMainId, Departmentid, Departmentname, Orderno, Positioncheckid, Positioncheck, Positionid, Position, Custno, Id, Devicename, Templatetypeid, Templatetypename, Spec, Specid, Manufacturer, Status, Remark, now() as CreateOn, '" + this.User.Id + "' as CreateUserId, '" + this.User.Realname + "' as CreateBy FROM "
|
|
|
insertEquipmentSQL += this.User.AccCode + LimsCheckEquipmentListName
|
|
|
- insertEquipmentSQL += " WHERE PositionCheckId=" + strconv.Itoa(model.AddressId)
|
|
|
+ insertEquipmentSQL += " WHERE PositionCheckId in (" + strPositionList + ")"
|
|
|
insertEquipmentSQL += " and TemplateTypeId=" + strconv.Itoa(model.ProjectTypeId)
|
|
|
if queryCheckDate != "" {
|
|
|
insertEquipmentSQL = insertEquipmentSQL + " and date_add(LastCheckDate, interval " + queryCheckDate + " month) >= now()"
|