Browse Source

erp 修改

pull/204/head
DESKTOP-4672LME\Xu Tengfei 3 years ago
parent
commit
ac57081031
5 changed files with 31 additions and 4 deletions
  1. +1
    -1
      db/db.go
  2. +7
    -0
      utils/k3cloud/base/curl.go
  3. +5
    -2
      utils/k3cloud/service/PLN_PLANORDER.go
  4. +8
    -1
      utils/k3cloud/service/PUR_Requisition.go
  5. +10
    -0
      utils/time.go

+ 1
- 1
db/db.go View File

@ -100,7 +100,7 @@ func InitDb() error {
if err != nil {
return err
}
//Eloquent.ShowSQL(true)
Eloquent.ShowSQL(false)
return nil
}


+ 7
- 0
utils/k3cloud/base/curl.go View File

@ -102,6 +102,13 @@ func (self *Browser) PostJson(requestUrl string, params map[string]interface{})
respCks := response.Cookies()
self.cookies = append(self.cookies, respCks...)
data, err := ioutil.ReadAll(response.Body)
result := string(data)
fmt.Println(result)
is := strings.Contains(result, "\"ErrorCode\":500,\"")
if is{
return nil, err
}
return data, err
}


+ 5
- 2
utils/k3cloud/service/PLN_PLANORDER.go View File

@ -83,6 +83,9 @@ func (_this *PLN_PLANORDER_Service) Save(PlantNr int, UserId string, articleDema
if err != nil || article == nil {
return "", err
}
//周一
articleDemand.PlanDate = grmi.Date(utils2.WeekDaySundayZeroTs(articleDemand.PlanDate.Restore()))
//当前周调整
if articleDemand.PlanDate.Restore().Before(time.Now()) {
articleDemand.PlanDate = grmi.Date(time.Now())
}
@ -116,10 +119,10 @@ func (_this *PLN_PLANORDER_Service) Save(PlantNr int, UserId string, articleDema
FNumber: article.UomId,
},
FPlanStartDate: articleDemand.PlanDate.ToString(),
FPlanFinishDate: articleDemand.PlanDate.ToString(),
FPlanFinishDate: utils2.WeekDaySundayZeroTs(articleDemand.PlanDate.Restore()).String(),
FFirmQty: int(articleDemand.PlanQty),
FFirmStartDate: articleDemand.PlanDate.ToString(),
FFirmFinishDate: articleDemand.PlanDate.ToString(),
FFirmFinishDate: utils2.WeekDaySundayZeroTs(articleDemand.PlanDate.Restore()).String(),
FInStockOrgID: _struct.FNumber{
FNumber: utils2.K3Obj.FUseOrgNo,
},


+ 8
- 1
utils/k3cloud/service/PUR_Requisition.go View File

@ -3,10 +3,12 @@ package service
import (
dal_base "leit.com/LAPP_CHEERSSON_BACKEND/dao/base"
"leit.com/LAPP_CHEERSSON_BACKEND/db"
"leit.com/LAPP_CHEERSSON_BACKEND/grmi"
model "leit.com/LAPP_CHEERSSON_BACKEND/models/ap"
utils2 "leit.com/LAPP_CHEERSSON_BACKEND/utils"
"leit.com/LAPP_CHEERSSON_BACKEND/utils/k3cloud/struct/PUR_Requisition"
request2 "leit.com/LAPP_CHEERSSON_BACKEND/utils/k3cloud/struct/request"
"time"
)
/**
供应链 - 采购管理 采购申请单
@ -75,7 +77,12 @@ func (_this *PUR_Requisition_Service) Save(PlantNr int, UserId string, articleDe
if err != nil || article == nil{
return err
}
//周一
articleDemand.DemandDate = grmi.Date(utils2.WeekDaySundayZeroTs(articleDemand.DemandDate.Restore()))
//当前周调整
if articleDemand.DemandDate.Restore().Before(time.Now()) {
articleDemand.DemandDate = grmi.Date(time.Now())
}
var entityList []PUR_Requisition.FEntity
entity := PUR_Requisition.FEntity{
FRequireOrgID: PUR_Requisition.FRequireOrgID{


+ 10
- 0
utils/time.go View File

@ -517,3 +517,13 @@ func WeekDayMondayZeroTs(now time.Time) time.Time {
weekStart := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, offset)
return weekStart
}
func WeekDaySundayZeroTs(now time.Time) time.Time {
offset := int(time.Sunday - now.Weekday())
if offset > 0 {
offset = -6
}
weekStart := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, offset)
return weekStart
}

Loading…
Cancel
Save