Browse Source

contract: 提添加净价字段和格式化时间字段

Yi 1 year ago
parent
commit
8a083abcce
1 changed files with 6 additions and 5 deletions
  1. 6 5
      apiserver/service/contract.go

+ 6 - 5
apiserver/service/contract.go

@@ -28,8 +28,7 @@ var (
 		},
 		DATA: &http.ContractDataToASP{},
 	}
-	loc, _     = time.LoadLocation("Local")
-	timeLayout = "2006-01-02 15:04:05"
+	loc, _ = time.LoadLocation("Local")
 )
 
 type ContractInfo struct {
@@ -120,7 +119,7 @@ func AutoContractToASP() {
 		for _, pastureBigContract := range pastureBigContractSlice {
 			// 获取合同相关数据集合
 			contractInfo := GetContractInfo(bigContract, pastureBigContract)
-			if len(contractInfo.Contract) == 0 {
+			if len(contractInfo.Contract) == 0 || pastureBigContract.PastureId == 18 {
 				continue
 			}
 			// 发送数据至SAP
@@ -141,8 +140,9 @@ func PushContractDataToSAP(bigContract *model.BigContract, contractInfo *Contrac
 		if contract.Enable == 0 {
 			LOEKZ = "X"
 		}
-		startTime, _ := time.ParseInLocation(timeLayout, bigContract.StartTime, loc)
-		stopTime, _ := time.ParseInLocation(timeLayout, bigContract.StopTime, loc)
+		startTime, _ := time.ParseInLocation(time.RFC3339, bigContract.StartTime, loc)
+		stopTime, _ := time.ParseInLocation(time.RFC3339, bigContract.StopTime, loc)
+
 		contractDataToASP := &http.ContractDataToASP{
 			MATNR: contract.PartCode,
 			LIFNR: contractInfo.Provider.SapCode,
@@ -150,6 +150,7 @@ func PushContractDataToSAP(bigContract *model.BigContract, contractInfo *Contrac
 			WERKS: contractInfo.Pasture.FactoryCode,
 			WAERS: "CNY",
 			PEINH: fmt.Sprintf("%f", contract.Price),
+			NETPR: fmt.Sprintf("%f", contract.Price),
 			MWSKZ: "J0",
 			EKGRP: contractInfo.Pasture.PurchasingGroup,
 			DATAB: startTime.Format("20060102"),