ilk
This commit is contained in:
6
svc/models/NewOrderNumberResponse.go
Normal file
6
svc/models/NewOrderNumberResponse.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package models
|
||||
|
||||
type NewOrderNumberResponse struct {
|
||||
OrderHeaderID string `json:"OrderHeaderID"`
|
||||
OrderNumber string `json:"OrderNumber"`
|
||||
}
|
||||
8
svc/models/account.go
Normal file
8
svc/models/account.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package models
|
||||
|
||||
// Cari hesap modeli
|
||||
type Account struct {
|
||||
DisplayCode string `json:"display_code"` // "ZLA 0127"
|
||||
AccountCode string `json:"account_code"` // "ZLA0127"
|
||||
AccountName string `json:"account_name"` // "EKO TEXTIL COM SRL" ya da ""
|
||||
}
|
||||
45
svc/models/custom_time.go
Normal file
45
svc/models/custom_time.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type CustomTime struct {
|
||||
sql.NullTime
|
||||
}
|
||||
|
||||
func (ct *CustomTime) UnmarshalJSON(b []byte) error {
|
||||
s := strings.Trim(string(b), `"`)
|
||||
if s == "" || s == "null" {
|
||||
ct.Valid = false
|
||||
return nil
|
||||
}
|
||||
|
||||
// DESTEKLENEN TÜM FORMATLAR
|
||||
layouts := []string{
|
||||
time.RFC3339, // 2025-11-21T00:10:27Z
|
||||
"2006-01-02T15:04:05", // 2025-11-21T00:10:27
|
||||
"2006-01-02 15:04:05", // 2025-11-21 00:10:27 ← FRONTEND FORMATIN!
|
||||
}
|
||||
|
||||
for _, layout := range layouts {
|
||||
if t, err := time.Parse(layout, s); err == nil {
|
||||
ct.Time = t
|
||||
ct.Valid = true
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// Hâlâ parse edemediyse → invalid kabul et
|
||||
ct.Valid = false
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ct CustomTime) MarshalJSON() ([]byte, error) {
|
||||
if ct.Valid {
|
||||
return []byte(`"` + ct.Time.Format("2006-01-02 15:04:05") + `"`), nil
|
||||
}
|
||||
return []byte(`null`), nil
|
||||
}
|
||||
13
svc/models/customerlist.go
Normal file
13
svc/models/customerlist.go
Normal file
@@ -0,0 +1,13 @@
|
||||
// models/customerlist.go
|
||||
package models
|
||||
|
||||
type CustomerList struct {
|
||||
CurrAccTypeCode int `json:"CurrAccTypeCode"` // 🆕 FK için lazım
|
||||
Cari_Kod string `json:"Cari_Kod"`
|
||||
Cari_Ad string `json:"Cari_Ad"`
|
||||
Musteri_Ana_Grubu string `json:"Musteri_Ana_Grubu"`
|
||||
Piyasa string `json:"Piyasa"`
|
||||
Musteri_Temsilcisi string `json:"Musteri_Temsilcisi"`
|
||||
Ulke string `json:"Ulke"`
|
||||
Doviz_cinsi string `json:"Doviz_Cinsi"`
|
||||
}
|
||||
13
svc/models/invalid_variant.go
Normal file
13
svc/models/invalid_variant.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package models
|
||||
|
||||
type InvalidVariant struct {
|
||||
Index int `json:"index"`
|
||||
ClientKey string `json:"clientKey"`
|
||||
ItemCode string `json:"itemCode"`
|
||||
ColorCode string `json:"colorCode"`
|
||||
Dim1 string `json:"dim1"`
|
||||
Dim2 string `json:"dim2"`
|
||||
Qty1 float64 `json:"qty1"`
|
||||
ComboKey string `json:"comboKey,omitempty"`
|
||||
Reason string `json:"reason,omitempty"`
|
||||
}
|
||||
57
svc/models/mk_user.go
Normal file
57
svc/models/mk_user.go
Normal file
@@ -0,0 +1,57 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type MkUser struct {
|
||||
// ==================================================
|
||||
// 🔑 PRIMARY ID (mk_dfusr.id)
|
||||
// ==================================================
|
||||
ID int64 `json:"id"` // mk_dfusr.id
|
||||
RoleID int64 `json:"role_id"`
|
||||
|
||||
// ==================================================
|
||||
// 🔁 LEGACY DFUSR (opsiyonel – migrate/debug)
|
||||
// ==================================================
|
||||
LegacyDfUsrID *int64 `json:"legacy_dfusr_id,omitempty"`
|
||||
|
||||
// ==================================================
|
||||
// 👤 CORE
|
||||
// ==================================================
|
||||
Username string `json:"username"`
|
||||
FullName string `json:"full_name"`
|
||||
Email string `json:"email"`
|
||||
Mobile string `json:"mobile"`
|
||||
IsActive bool `json:"is_active"`
|
||||
|
||||
// ==================================================
|
||||
// 🔐 AUTH
|
||||
// ==================================================
|
||||
PasswordHash string `json:"-"`
|
||||
ForcePasswordChange bool `json:"force_password_change"`
|
||||
PasswordUpdatedAt *time.Time `json:"password_updated_at,omitempty"`
|
||||
SessionID string `json:"session_id"`
|
||||
|
||||
// ==================================================
|
||||
// 🧩 ROLE
|
||||
// ==================================================
|
||||
RoleCode string `json:"role_code"`
|
||||
|
||||
// ==================================================
|
||||
// 🧾 NEBIM
|
||||
// ==================================================
|
||||
V3Username string `json:"v3_username"`
|
||||
V3UserGroup string `json:"v3_usergroup"`
|
||||
|
||||
// ==================================================
|
||||
// 🏭 RUNTIME SCOPES
|
||||
// ==================================================
|
||||
DepartmentCodes []string `json:"departments"`
|
||||
PiyasaCodes []string `json:"piyasalar"`
|
||||
|
||||
// ==================================================
|
||||
// ⏱ AUDIT
|
||||
// ==================================================
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
LastLoginAt *time.Time `json:"last_login_at,omitempty"`
|
||||
}
|
||||
16
svc/models/modelcombo_error.go
Normal file
16
svc/models/modelcombo_error.go
Normal file
@@ -0,0 +1,16 @@
|
||||
// models/errors.go
|
||||
package models
|
||||
|
||||
type ValidationError struct {
|
||||
Code string `json:"code"`
|
||||
Message string `json:"message"`
|
||||
ClientKey string `json:"clientKey,omitempty"`
|
||||
ItemCode string `json:"itemCode,omitempty"`
|
||||
ColorCode string `json:"colorCode,omitempty"`
|
||||
Dim1 string `json:"dim1,omitempty"`
|
||||
Dim2 string `json:"dim2,omitempty"`
|
||||
}
|
||||
|
||||
func (e *ValidationError) Error() string {
|
||||
return e.Message
|
||||
}
|
||||
120
svc/models/null_uuid.go
Normal file
120
svc/models/null_uuid.go
Normal file
@@ -0,0 +1,120 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ============================================================
|
||||
// 🔹 NullUUID — MSSQL UNIQUEIDENTIFIER için nullable tip
|
||||
// ============================================================
|
||||
type NullUUID struct {
|
||||
UUID string `json:"UUID"`
|
||||
Valid bool `json:"Valid"`
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
//
|
||||
// SQL Valuer (INSERT/UPDATE parametresi)
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
func (n NullUUID) Value() (driver.Value, error) {
|
||||
if !n.Valid || strings.TrimSpace(n.UUID) == "" {
|
||||
return nil, nil
|
||||
}
|
||||
return n.UUID, nil
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
//
|
||||
// SQL Scanner (SELECT sonucu)
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
func (n *NullUUID) Scan(value interface{}) error {
|
||||
if value == nil {
|
||||
n.UUID = ""
|
||||
n.Valid = false
|
||||
return nil
|
||||
}
|
||||
|
||||
switch v := value.(type) {
|
||||
case string:
|
||||
n.UUID = v
|
||||
n.Valid = true
|
||||
case []byte:
|
||||
n.UUID = string(v)
|
||||
n.Valid = true
|
||||
default:
|
||||
n.UUID = ""
|
||||
n.Valid = false
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
//
|
||||
// JSON Marshal — Go → JSON
|
||||
// Null ise: null
|
||||
// Değer varsa: "guid-string"
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
func (n NullUUID) MarshalJSON() ([]byte, error) {
|
||||
if !n.Valid || strings.TrimSpace(n.UUID) == "" {
|
||||
return []byte("null"), nil
|
||||
}
|
||||
return json.Marshal(n.UUID)
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
//
|
||||
// JSON Unmarshal — JSON → Go
|
||||
// Kabul ettiği formatlar:
|
||||
// • null
|
||||
// • "guid-string"
|
||||
// • {"UUID":"...","Valid":true} (ileride istersen)
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
func (n *NullUUID) UnmarshalJSON(data []byte) error {
|
||||
s := strings.TrimSpace(string(data))
|
||||
|
||||
// null veya boş
|
||||
if s == "null" || s == "" {
|
||||
n.UUID = ""
|
||||
n.Valid = false
|
||||
return nil
|
||||
}
|
||||
|
||||
// Önce string gibi dene: "guid"
|
||||
var str string
|
||||
if err := json.Unmarshal(data, &str); err == nil {
|
||||
str = strings.TrimSpace(str)
|
||||
if str == "" {
|
||||
n.UUID = ""
|
||||
n.Valid = false
|
||||
} else {
|
||||
n.UUID = str
|
||||
n.Valid = true
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Objeyse: { "UUID":"...", "Valid":true }
|
||||
var aux struct {
|
||||
UUID string `json:"UUID"`
|
||||
Valid bool `json:"Valid"`
|
||||
}
|
||||
if err := json.Unmarshal(data, &aux); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
aux.UUID = strings.TrimSpace(aux.UUID)
|
||||
if aux.UUID == "" || !aux.Valid {
|
||||
n.UUID = ""
|
||||
n.Valid = false
|
||||
} else {
|
||||
n.UUID = aux.UUID
|
||||
n.Valid = true
|
||||
}
|
||||
return nil
|
||||
}
|
||||
54
svc/models/order_pdf.go
Normal file
54
svc/models/order_pdf.go
Normal file
@@ -0,0 +1,54 @@
|
||||
package models
|
||||
|
||||
// ===============================
|
||||
// 🔹 ORDER HEADER (PDF için)
|
||||
// ===============================
|
||||
type OrderHeaderPDF struct {
|
||||
OrderHeaderID string `json:"OrderHeaderID"`
|
||||
OrderNumber string `json:"OrderNumber"`
|
||||
CurrAccCode string `json:"CurrAccCode"`
|
||||
CariAdi string `json:"CariAdi"`
|
||||
OrderDate string `json:"OrderDate"` // yyyy-MM-dd
|
||||
AverageDueDate string `json:"AverageDueDate"` // Termin
|
||||
Description string `json:"Description"`
|
||||
}
|
||||
|
||||
// ===============================
|
||||
// 🔹 ORDER LINE (PDF için)
|
||||
// ===============================
|
||||
type OrderLinePDF struct {
|
||||
OrderLineID string `json:"OrderLineID"`
|
||||
OrderHeaderID string `json:"OrderHeaderID"`
|
||||
|
||||
Model string `json:"Model"`
|
||||
Renk string `json:"Renk"`
|
||||
Renk2 string `json:"Renk2"`
|
||||
AnaGrup string `json:"AnaGrup"`
|
||||
AltGrup string `json:"AltGrup"`
|
||||
Aciklama string `json:"Aciklama"`
|
||||
|
||||
Fiyat float64 `json:"Fiyat"`
|
||||
Adet float64 `json:"Adet"`
|
||||
Tutar float64 `json:"Tutar"`
|
||||
PB string `json:"PB"`
|
||||
|
||||
TerminTarihi string `json:"TerminTarihi"`
|
||||
|
||||
// 16 beden alanı
|
||||
Size1 float64 `json:"Size1"`
|
||||
Size2 float64 `json:"Size2"`
|
||||
Size3 float64 `json:"Size3"`
|
||||
Size4 float64 `json:"Size4"`
|
||||
Size5 float64 `json:"Size5"`
|
||||
Size6 float64 `json:"Size6"`
|
||||
Size7 float64 `json:"Size7"`
|
||||
Size8 float64 `json:"Size8"`
|
||||
Size9 float64 `json:"Size9"`
|
||||
Size10 float64 `json:"Size10"`
|
||||
Size11 float64 `json:"Size11"`
|
||||
Size12 float64 `json:"Size12"`
|
||||
Size13 float64 `json:"Size13"`
|
||||
Size14 float64 `json:"Size14"`
|
||||
Size15 float64 `json:"Size15"`
|
||||
Size16 float64 `json:"Size16"`
|
||||
}
|
||||
98
svc/models/orderdetail.go
Normal file
98
svc/models/orderdetail.go
Normal file
@@ -0,0 +1,98 @@
|
||||
package models
|
||||
|
||||
// ============================================================
|
||||
// 📦 ORDER DETAIL (trOrderLine)
|
||||
// ============================================================
|
||||
type OrderDetail struct {
|
||||
OrderLineID string `json:"OrderLineID"`
|
||||
|
||||
// 🔑 Frontend’den gelen benzersiz anahtar (sadece JSON, DB kolonu değil)
|
||||
ClientKey NullString `json:"clientKey"`
|
||||
ComboKey NullString `json:"ComboKey"`
|
||||
SortOrder NullInt32 `json:"SortOrder"`
|
||||
ItemTypeCode NullInt16 `json:"ItemTypeCode"`
|
||||
ItemCode NullString `json:"ItemCode"`
|
||||
ColorCode NullString `json:"ColorCode"`
|
||||
ItemDim1Code NullString `json:"ItemDim1Code"`
|
||||
ItemDim2Code NullString `json:"ItemDim2Code"`
|
||||
ItemDim3Code NullString `json:"ItemDim3Code"`
|
||||
|
||||
Qty1 NullFloat64 `json:"Qty1"`
|
||||
Qty2 NullFloat64 `json:"Qty2"`
|
||||
|
||||
CancelQty1 NullFloat64 `json:"CancelQty1"`
|
||||
CancelQty2 NullFloat64 `json:"CancelQty2"`
|
||||
CancelDate NullTime `json:"CancelDate"`
|
||||
|
||||
OrderCancelReasonCode NullString `json:"OrderCancelReasonCode"`
|
||||
ClosedDate NullTime `json:"ClosedDate"`
|
||||
IsClosed NullBool `json:"IsClosed"`
|
||||
|
||||
SalespersonCode NullString `json:"SalespersonCode"`
|
||||
PaymentPlanCode NullString `json:"PaymentPlanCode"`
|
||||
PurchasePlanCode NullString `json:"PurchasePlanCode"`
|
||||
|
||||
// MSSQL smalldatetime
|
||||
DeliveryDate NullTime `json:"DeliveryDate"`
|
||||
|
||||
// MSSQL date (YYYY-MM-DD)
|
||||
PlannedDateOfLading NullString `json:"PlannedDateOfLading"`
|
||||
|
||||
LineDescription NullString `json:"LineDescription"`
|
||||
UsedBarcode NullString `json:"UsedBarcode"`
|
||||
CostCenterCode NullString `json:"CostCenterCode"`
|
||||
|
||||
VatCode NullString `json:"VatCode"`
|
||||
VatRate NullFloat64 `json:"VatRate"`
|
||||
|
||||
PCTCode NullString `json:"PCTCode"`
|
||||
PCTRate NullFloat64 `json:"PCTRate"`
|
||||
|
||||
LDisRate1 NullFloat64 `json:"LDisRate1"`
|
||||
LDisRate2 NullFloat64 `json:"LDisRate2"`
|
||||
LDisRate3 NullFloat64 `json:"LDisRate3"`
|
||||
LDisRate4 NullFloat64 `json:"LDisRate4"`
|
||||
LDisRate5 NullFloat64 `json:"LDisRate5"`
|
||||
|
||||
DocCurrencyCode NullString `json:"DocCurrencyCode"`
|
||||
PriceCurrencyCode NullString `json:"PriceCurrencyCode"`
|
||||
PriceExchangeRate NullFloat64 `json:"PriceExchangeRate"`
|
||||
|
||||
Price NullFloat64 `json:"Price"`
|
||||
|
||||
PriceListLineID NullString `json:"PriceListLineID"`
|
||||
|
||||
BaseProcessCode NullString `json:"BaseProcessCode"`
|
||||
BaseOrderNumber NullString `json:"BaseOrderNumber"`
|
||||
BaseCustomerTypeCode NullInt32 `json:"BaseCustomerTypeCode"`
|
||||
BaseCustomerCode NullString `json:"BaseCustomerCode"`
|
||||
BaseSubCurrAccID NullString `json:"BaseSubCurrAccID"`
|
||||
BaseStoreCode NullString `json:"BaseStoreCode"`
|
||||
|
||||
SupportRequestHeaderID NullString `json:"SupportRequestHeaderID"`
|
||||
|
||||
OrderHeaderID string `json:"OrderHeaderID"`
|
||||
|
||||
OrderLineSumID NullInt32 `json:"OrderLineSumID"`
|
||||
OrderLineBOMID NullInt32 `json:"OrderLineBOMID"`
|
||||
|
||||
CreatedUserName NullString `json:"CreatedUserName"`
|
||||
CreatedDate NullString `json:"CreatedDate"`
|
||||
LastUpdatedUserName NullString `json:"LastUpdatedUserName"`
|
||||
LastUpdatedDate NullString `json:"LastUpdatedDate"`
|
||||
|
||||
SurplusOrderQtyToleranceRate NullFloat64 `json:"SurplusOrderQtyToleranceRate"`
|
||||
|
||||
PurchaseRequisitionLineID NullString `json:"PurchaseRequisitionLineID"`
|
||||
WithHoldingTaxTypeCode NullString `json:"WithHoldingTaxTypeCode"`
|
||||
|
||||
DOVCode NullString `json:"DOVCode"`
|
||||
OrderLineLinkedProductID NullString `json:"OrderLineLinkedProductID"`
|
||||
|
||||
// JOIN attr
|
||||
UrunIlkGrubu NullString `json:"UrunIlkGrubu"`
|
||||
UrunAnaGrubu NullString `json:"UrunAnaGrubu"`
|
||||
UrunAltGrubu NullString `json:"UrunAltGrubu"`
|
||||
Fit1 NullString `json:"Fit1"`
|
||||
Fit2 NullString `json:"Fit2"`
|
||||
}
|
||||
109
svc/models/orderheader.go
Normal file
109
svc/models/orderheader.go
Normal file
@@ -0,0 +1,109 @@
|
||||
package models
|
||||
|
||||
// ============================================================
|
||||
// 🧾 ORDER HEADER
|
||||
// ============================================================
|
||||
type OrderHeader struct {
|
||||
OrderHeaderID string `json:"OrderHeaderID"`
|
||||
|
||||
OrderTypeCode NullInt16 `json:"OrderTypeCode"`
|
||||
ProcessCode NullString `json:"ProcessCode"`
|
||||
OrderNumber NullString `json:"OrderNumber"`
|
||||
IsCancelOrder NullBool `json:"IsCancelOrder"`
|
||||
|
||||
// 🔥 Date & Time string olarak geliyor (frontend)
|
||||
OrderDate NullString `json:"OrderDate"` // "YYYY-MM-DD"
|
||||
OrderTime NullString `json:"OrderTime"` // "HH:mm:ss"
|
||||
|
||||
DocumentNumber NullString `json:"DocumentNumber"`
|
||||
|
||||
PaymentTerm NullInt16 `json:"PaymentTerm"`
|
||||
AverageDueDate NullString `json:"AverageDueDate"` // "YYYY-MM-DD"
|
||||
|
||||
Description NullString `json:"Description"`
|
||||
InternalDescription NullString `json:"InternalDescription"`
|
||||
|
||||
CurrAccTypeCode NullInt16 `json:"CurrAccTypeCode"`
|
||||
CurrAccCode NullString `json:"CurrAccCode"`
|
||||
|
||||
CurrAccDescription NullString `json:"CurrAccDescription"`
|
||||
|
||||
// 🔥 GUID alanları NullUUID yapıldı
|
||||
SubCurrAccID NullUUID `json:"SubCurrAccID"`
|
||||
ContactID NullUUID `json:"ContactID"`
|
||||
ShipmentMethodCode NullString `json:"ShipmentMethodCode"`
|
||||
ShippingPostalAddressID NullUUID `json:"ShippingPostalAddressID"`
|
||||
BillingPostalAddressID NullUUID `json:"BillingPostalAddressID"`
|
||||
GuarantorContactID NullUUID `json:"GuarantorContactID"`
|
||||
GuarantorContactID2 NullUUID `json:"GuarantorContactID2"`
|
||||
|
||||
RoundsmanCode NullString `json:"RoundsmanCode"`
|
||||
DeliveryCompanyCode NullString `json:"DeliveryCompanyCode"`
|
||||
|
||||
TaxTypeCode NullInt16 `json:"TaxTypeCode"`
|
||||
WithHoldingTaxTypeCode NullString `json:"WithHoldingTaxTypeCode"`
|
||||
DOVCode NullString `json:"DOVCode"`
|
||||
TaxExemptionCode NullInt16 `json:"TaxExemptionCode"`
|
||||
|
||||
CompanyCode NullInt32 `json:"CompanyCode"`
|
||||
OfficeCode NullString `json:"OfficeCode"`
|
||||
StoreTypeCode NullInt16 `json:"StoreTypeCode"`
|
||||
StoreCode NullString `json:"StoreCode"`
|
||||
|
||||
POSTerminalID NullInt16 `json:"POSTerminalID"`
|
||||
WarehouseCode NullString `json:"WarehouseCode"`
|
||||
ToWarehouseCode NullString `json:"ToWarehouseCode"`
|
||||
|
||||
OrdererCompanyCode NullInt32 `json:"OrdererCompanyCode"`
|
||||
OrdererOfficeCode NullString `json:"OrdererOfficeCode"`
|
||||
OrdererStoreCode NullString `json:"OrdererStoreCode"`
|
||||
|
||||
GLTypeCode NullString `json:"GLTypeCode"`
|
||||
DocCurrencyCode NullString `json:"DocCurrencyCode"`
|
||||
LocalCurrencyCode NullString `json:"LocalCurrencyCode"`
|
||||
ExchangeRate NullFloat64 `json:"ExchangeRate"`
|
||||
|
||||
TDisRate1 NullFloat64 `json:"TDisRate1"`
|
||||
TDisRate2 NullFloat64 `json:"TDisRate2"`
|
||||
TDisRate3 NullFloat64 `json:"TDisRate3"`
|
||||
TDisRate4 NullFloat64 `json:"TDisRate4"`
|
||||
TDisRate5 NullFloat64 `json:"TDisRate5"`
|
||||
|
||||
DiscountReasonCode NullInt16 `json:"DiscountReasonCode"`
|
||||
SurplusOrderQtyToleranceRate NullFloat64 `json:"SurplusOrderQtyToleranceRate"`
|
||||
|
||||
ImportFileNumber NullString `json:"ImportFileNumber"`
|
||||
ExportFileNumber NullString `json:"ExportFileNumber"`
|
||||
IncotermCode1 NullString `json:"IncotermCode1"`
|
||||
IncotermCode2 NullString `json:"IncotermCode2"`
|
||||
LettersOfCreditNumber NullString `json:"LettersOfCreditNumber"`
|
||||
PaymentMethodCode NullString `json:"PaymentMethodCode"`
|
||||
|
||||
IsInclutedVat NullBool `json:"IsInclutedVat"`
|
||||
IsCreditSale NullBool `json:"IsCreditSale"`
|
||||
IsCreditableConfirmed NullBool `json:"IsCreditableConfirmed"`
|
||||
|
||||
CreditableConfirmedUser NullString `json:"CreditableConfirmedUser"`
|
||||
// MSSQL datetime
|
||||
CreditableConfirmedDate CustomTime `json:"CreditableConfirmedDate"`
|
||||
|
||||
IsSalesViaInternet NullBool `json:"IsSalesViaInternet"`
|
||||
IsSuspended NullBool `json:"IsSuspended"`
|
||||
IsCompleted NullBool `json:"IsCompleted"`
|
||||
IsPrinted NullBool `json:"IsPrinted"`
|
||||
IsLocked NullBool `json:"IsLocked"`
|
||||
UserLocked NullBool `json:"UserLocked"`
|
||||
IsClosed NullBool `json:"IsClosed"`
|
||||
|
||||
ApplicationCode NullString `json:"ApplicationCode"`
|
||||
ApplicationID NullUUID `json:"ApplicationID"`
|
||||
|
||||
CreatedUserName NullString `json:"CreatedUserName"`
|
||||
// Frontend "YYYY-MM-DD HH:mm:ss" gönderiyor
|
||||
CreatedDate NullString `json:"CreatedDate"`
|
||||
|
||||
LastUpdatedUserName NullString `json:"LastUpdatedUserName"`
|
||||
LastUpdatedDate NullString `json:"LastUpdatedDate"`
|
||||
|
||||
IsProposalBased NullBool `json:"IsProposalBased"`
|
||||
}
|
||||
10
svc/models/orderinventory.go
Normal file
10
svc/models/orderinventory.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package models
|
||||
|
||||
type OrderInventory struct {
|
||||
UrunKodu string `json:"urun_kodu"`
|
||||
RenkKodu string `json:"renk_kodu"`
|
||||
RenkAciklamasi string `json:"renk_aciklamasi"`
|
||||
Beden string `json:"beden"`
|
||||
Yaka string `json:"yaka"`
|
||||
KullanilabilirEnvanter float64 `json:"kullanilabilir_envanter"`
|
||||
}
|
||||
35
svc/models/orderlist.go
Normal file
35
svc/models/orderlist.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package models
|
||||
|
||||
// ========================================================
|
||||
// 📌 OrderList — Sipariş Listeleme Modeli (FINAL & UI SAFE)
|
||||
// ========================================================
|
||||
type OrderList struct {
|
||||
|
||||
// 🆔 Sipariş Bilgileri
|
||||
OrderHeaderID string `json:"OrderHeaderID"`
|
||||
OrderNumber string `json:"OrderNumber"`
|
||||
OrderDate string `json:"OrderDate"`
|
||||
|
||||
// 🧾 Cari Bilgileri
|
||||
CurrAccCode string `json:"CurrAccCode"`
|
||||
CurrAccDescription string `json:"CurrAccDescription"`
|
||||
|
||||
// 👤 Müşteri Tanımları
|
||||
MusteriTemsilcisi string `json:"MusteriTemsilcisi"`
|
||||
Piyasa string `json:"Piyasa"`
|
||||
|
||||
// ℹ️ Sipariş Durumu
|
||||
CreditableConfirmedDate string `json:"CreditableConfirmedDate"`
|
||||
IsCreditableConfirmed bool `json:"IsCreditableConfirmed"`
|
||||
|
||||
// 💱 Para Birimi
|
||||
DocCurrencyCode string `json:"DocCurrencyCode"`
|
||||
|
||||
// 💰 Tutarlar
|
||||
TotalAmount float64 `json:"TotalAmount"`
|
||||
TotalAmountUSD float64 `json:"TotalAmountUSD"`
|
||||
|
||||
// 📝 Açıklama
|
||||
Description string `json:"Description"`
|
||||
ExchangeRateUSD float64 `json:"ExchangeRateUSD"`
|
||||
}
|
||||
179
svc/models/ordernull_types.go
Normal file
179
svc/models/ordernull_types.go
Normal file
@@ -0,0 +1,179 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
/* ==============================================================
|
||||
🔹 NULL TYPE WRAPPERS
|
||||
MSSQL sql.Null* tiplerini JSON'a dönüştürürken:
|
||||
- null yerine "", 0 veya false döndürür
|
||||
- frontend'de (Vue/Quasar) doğrudan okunabilir hale getirir
|
||||
============================================================== */
|
||||
|
||||
// 🟦 STRING
|
||||
type NullString struct {
|
||||
sql.NullString
|
||||
}
|
||||
|
||||
func (ns *NullString) MarshalJSON() ([]byte, error) {
|
||||
if ns.Valid {
|
||||
return json.Marshal(ns.String)
|
||||
}
|
||||
return json.Marshal("")
|
||||
}
|
||||
|
||||
func (ns *NullString) UnmarshalJSON(b []byte) error {
|
||||
var s *string
|
||||
if err := json.Unmarshal(b, &s); err != nil {
|
||||
return err
|
||||
}
|
||||
if s != nil {
|
||||
ns.Valid = true
|
||||
ns.String = *s
|
||||
} else {
|
||||
ns.Valid = false
|
||||
ns.String = ""
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 🟩 INT32
|
||||
type NullInt32 struct {
|
||||
sql.NullInt32
|
||||
}
|
||||
|
||||
func (ni *NullInt32) MarshalJSON() ([]byte, error) {
|
||||
if ni.Valid {
|
||||
return json.Marshal(ni.Int32)
|
||||
}
|
||||
return json.Marshal(0)
|
||||
}
|
||||
|
||||
func (ni *NullInt32) UnmarshalJSON(b []byte) error {
|
||||
var n *int32
|
||||
if err := json.Unmarshal(b, &n); err != nil {
|
||||
return err
|
||||
}
|
||||
if n != nil {
|
||||
ni.Valid = true
|
||||
ni.Int32 = *n
|
||||
} else {
|
||||
ni.Valid = false
|
||||
ni.Int32 = 0
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 🟧 INT16
|
||||
type NullInt16 struct {
|
||||
sql.NullInt16
|
||||
}
|
||||
|
||||
func (ni *NullInt16) MarshalJSON() ([]byte, error) {
|
||||
if ni.Valid {
|
||||
return json.Marshal(ni.Int16)
|
||||
}
|
||||
return json.Marshal(0)
|
||||
}
|
||||
|
||||
func (ni *NullInt16) UnmarshalJSON(b []byte) error {
|
||||
var n *int16
|
||||
if err := json.Unmarshal(b, &n); err != nil {
|
||||
return err
|
||||
}
|
||||
if n != nil {
|
||||
ni.Valid = true
|
||||
ni.Int16 = *n
|
||||
} else {
|
||||
ni.Valid = false
|
||||
ni.Int16 = 0
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 🟨 FLOAT64
|
||||
type NullFloat64 struct {
|
||||
sql.NullFloat64
|
||||
}
|
||||
|
||||
func (nf *NullFloat64) MarshalJSON() ([]byte, error) {
|
||||
if nf.Valid {
|
||||
return json.Marshal(nf.Float64)
|
||||
}
|
||||
return json.Marshal(0.0)
|
||||
}
|
||||
|
||||
func (nf *NullFloat64) UnmarshalJSON(b []byte) error {
|
||||
var f *float64
|
||||
if err := json.Unmarshal(b, &f); err != nil {
|
||||
return err
|
||||
}
|
||||
if f != nil {
|
||||
nf.Valid = true
|
||||
nf.Float64 = *f
|
||||
} else {
|
||||
nf.Valid = false
|
||||
nf.Float64 = 0
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 🟥 BOOL
|
||||
type NullBool struct {
|
||||
sql.NullBool
|
||||
}
|
||||
|
||||
func (nb *NullBool) MarshalJSON() ([]byte, error) {
|
||||
if nb.Valid {
|
||||
return json.Marshal(nb.Bool)
|
||||
}
|
||||
return json.Marshal(false)
|
||||
}
|
||||
|
||||
func (nb *NullBool) UnmarshalJSON(b []byte) error {
|
||||
var v *bool
|
||||
if err := json.Unmarshal(b, &v); err != nil {
|
||||
return err
|
||||
}
|
||||
if v != nil {
|
||||
nb.Valid = true
|
||||
nb.Bool = *v
|
||||
} else {
|
||||
nb.Valid = false
|
||||
nb.Bool = false
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 🟪 TIME
|
||||
type NullTime struct {
|
||||
sql.NullTime
|
||||
}
|
||||
|
||||
func (nt *NullTime) MarshalJSON() ([]byte, error) {
|
||||
if nt.Valid {
|
||||
return json.Marshal(nt.Time.Format("2006-01-02 15:04:05"))
|
||||
}
|
||||
return json.Marshal(nil)
|
||||
}
|
||||
|
||||
func (nt *NullTime) UnmarshalJSON(b []byte) error {
|
||||
var s *string
|
||||
if err := json.Unmarshal(b, &s); err != nil {
|
||||
return err
|
||||
}
|
||||
if s != nil && *s != "" {
|
||||
t, err := time.Parse("2006-01-02 15:04:05", *s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
nt.Valid = true
|
||||
nt.Time = t
|
||||
} else {
|
||||
nt.Valid = false
|
||||
}
|
||||
return nil
|
||||
}
|
||||
13
svc/models/orderpricelistb2b.go
Normal file
13
svc/models/orderpricelistb2b.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package models
|
||||
|
||||
// OrderPriceListB2B B2B ürün fiyat listesini temsil eder
|
||||
type OrderPriceListB2B struct {
|
||||
ModelCode string `json:"modelCode"`
|
||||
CurrencyCode string `json:"currencyCode"`
|
||||
Price float64 `json:"price"`
|
||||
PriceGroupID int `json:"priceGroupId"`
|
||||
LastUpdate string `json:"lastUpdate"`
|
||||
RateToTRY float64 `json:"rateToTRY"`
|
||||
PriceTRY float64 `json:"priceTRY"`
|
||||
BaseCurrency string `json:"baseCurrency"`
|
||||
}
|
||||
5
svc/models/product.go
Normal file
5
svc/models/product.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package models
|
||||
|
||||
type Product struct {
|
||||
ProductCode string `json:"ProductCode"` // ✅ büyük P harf ile
|
||||
}
|
||||
7
svc/models/productcolor.go
Normal file
7
svc/models/productcolor.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package models
|
||||
|
||||
type ProductColor struct {
|
||||
ProductCode string `json:"product_code"`
|
||||
ColorCode string `json:"color_code"`
|
||||
ColorDescription string `json:"color_description"`
|
||||
}
|
||||
9
svc/models/productcolorsize.go
Normal file
9
svc/models/productcolorsize.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package models
|
||||
|
||||
// 🔹 Ürün renk + beden varyasyon listesi (açıklamalar çıkarıldı)
|
||||
type ProductColorSize struct {
|
||||
ProductCode string `json:"product_code"`
|
||||
ColorCode string `json:"color_code"`
|
||||
ItemDim1Code string `json:"item_dim1_code"`
|
||||
ItemDim2Code string `json:"item_dim2_code"`
|
||||
}
|
||||
14
svc/models/productdetail.go
Normal file
14
svc/models/productdetail.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package models
|
||||
|
||||
type ProductDetail struct {
|
||||
ProductCode string `json:"ProductCode"`
|
||||
UrunIlkGrubu string `json:"UrunIlkGrubu"`
|
||||
UrunAnaGrubu string `json:"UrunAnaGrubu"`
|
||||
UrunAltGrubu string `json:"UrunAltGrubu"`
|
||||
UrunIcerik string `json:"UrunIcerik"`
|
||||
Drop string `json:"Drop"`
|
||||
Kategori string `json:"Kategori"`
|
||||
AskiliYan string `json:"AskiliYan"`
|
||||
Fit1 string `json:"Fit1"`
|
||||
Fit2 string `json:"Fit2"`
|
||||
}
|
||||
7
svc/models/productsecondcolor.go
Normal file
7
svc/models/productsecondcolor.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package models
|
||||
|
||||
type ProductSecondColor struct {
|
||||
ProductCode string `json:"product_code"`
|
||||
ColorCode string `json:"color_code"`
|
||||
ItemDim2Code string `json:"item_dim2_code"`
|
||||
}
|
||||
17
svc/models/statement_detail.go
Normal file
17
svc/models/statement_detail.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package models
|
||||
|
||||
// Detay tablo (alt satır)
|
||||
type StatementDetail struct {
|
||||
BelgeTarihi string `json:"belge_tarihi"` // Belge tarihi
|
||||
BelgeRefNumarasi string `json:"belge_ref_numarasi"` // Belge referans numarası
|
||||
UrunAnaGrubu string `json:"urun_ana_grubu"` // Ürün ana grubu
|
||||
UrunAltGrubu string `json:"urun_alt_grubu"` // Ürün alt grubu
|
||||
YetiskinGarson string `json:"yetiskin_garson"` // Yetişkin/Çocuk (garson)
|
||||
Fit string `json:"fit"` // Fit bilgisi
|
||||
Icerik string `json:"icerik"` // İçerik
|
||||
UrunKodu string `json:"urun_kodu"` // Ürün kodu
|
||||
UrunRengi string `json:"urun_rengi"` // Ürün rengi
|
||||
ToplamAdet float64 `json:"toplam_adet"` // Toplam adet
|
||||
ToplamFiyat float64 `json:"toplam_fiyat"` // Birim fiyat
|
||||
ToplamTutar float64 `json:"toplam_tutar"` // Toplam tutar
|
||||
}
|
||||
41
svc/models/statement_header.go
Normal file
41
svc/models/statement_header.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
type StatementHeader struct {
|
||||
CariKod string `json:"cari_kod"`
|
||||
CariIsim string `json:"cari_isim"`
|
||||
BelgeTarihi string `json:"belge_tarihi"`
|
||||
VadeTarihi string `json:"vade_tarihi"`
|
||||
BelgeNo string `json:"belge_no"`
|
||||
IslemTipi string `json:"islem_tipi"`
|
||||
Aciklama string `json:"aciklama"`
|
||||
ParaBirimi string `json:"para_birimi"`
|
||||
Borc float64 `json:"borc"`
|
||||
Alacak float64 `json:"alacak"`
|
||||
Bakiye float64 `json:"bakiye"`
|
||||
Parislemler sql.NullString `json:"parislemler"`
|
||||
|
||||
// 🔹 PDF için detaylar
|
||||
Details []StatementDetail `json:"details,omitempty"`
|
||||
}
|
||||
|
||||
// JSON dönüşümünde NULL değerleri "" yap
|
||||
func (s StatementHeader) MarshalJSON() ([]byte, error) {
|
||||
type Alias StatementHeader
|
||||
return json.Marshal(&struct {
|
||||
Parislemler string `json:"parislemler"`
|
||||
*Alias
|
||||
}{
|
||||
Parislemler: func() string {
|
||||
if s.Parislemler.Valid {
|
||||
return s.Parislemler.String
|
||||
}
|
||||
return ""
|
||||
}(),
|
||||
Alias: (*Alias)(&s),
|
||||
})
|
||||
}
|
||||
10
svc/models/statements_params.go
Normal file
10
svc/models/statements_params.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package models
|
||||
|
||||
type StatementParams struct {
|
||||
CariKod string `json:"cari_kod"`
|
||||
StartDate string `json:"startdate"`
|
||||
EndDate string `json:"enddate"`
|
||||
AccountCode string `json:"accountcode"`
|
||||
LangCode string `json:"langcode"`
|
||||
Parislemler []string `json:"parislemler"` // ✅ slice olmalı
|
||||
}
|
||||
10
svc/models/todaycurrencyv3.go
Normal file
10
svc/models/todaycurrencyv3.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package models
|
||||
|
||||
// TodayCurrencyV3 sistemdeki döviz kurlarını temsil eder
|
||||
type TodayCurrencyV3 struct {
|
||||
CurrencyCode string `json:"currencyCode"`
|
||||
RelationCurrencyCode string `json:"relationCurrencyCode"`
|
||||
ExchangeTypeCode int `json:"exchangeTypeCode"`
|
||||
Rate float64 `json:"rate"`
|
||||
Date string `json:"date"`
|
||||
}
|
||||
88
svc/models/user_detail.go
Normal file
88
svc/models/user_detail.go
Normal file
@@ -0,0 +1,88 @@
|
||||
package models
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
// ======================================================
|
||||
// 👤 USER DETAIL — GET RESPONSE
|
||||
// UserDetail.vue formuna birebir
|
||||
// ======================================================
|
||||
type UserDetail struct {
|
||||
ID int64 `json:"id"`
|
||||
Code string `json:"code"`
|
||||
IsActive bool `json:"is_active"`
|
||||
FullName string `json:"full_name"`
|
||||
Email string `json:"email"`
|
||||
Mobile string `json:"mobile"`
|
||||
Address string `json:"address"`
|
||||
|
||||
HasPassword bool `json:"has_password"` // 🔐 SADECE DURUM
|
||||
|
||||
// ===== İLİŞKİLER =====
|
||||
Roles []string `json:"roles"`
|
||||
Departments []DeptOption `json:"departments"`
|
||||
Piyasalar []DeptOption `json:"piyasalar"`
|
||||
NebimUsers []NebimOption `json:"nebim_users"`
|
||||
}
|
||||
|
||||
// ======================================================
|
||||
// ✍️ USER WRITE — PUT PAYLOAD
|
||||
// ======================================================
|
||||
type UserWrite struct {
|
||||
Code string `json:"code"`
|
||||
IsActive bool `json:"is_active"`
|
||||
FullName string `json:"full_name"`
|
||||
Email string `json:"email"`
|
||||
Mobile string `json:"mobile"`
|
||||
Address string `json:"address"`
|
||||
|
||||
Roles []string `json:"roles"`
|
||||
Departments []DeptOption `json:"departments"`
|
||||
Piyasalar []DeptOption `json:"piyasalar"`
|
||||
NebimUsers []NebimOption `json:"nebim_users"`
|
||||
}
|
||||
|
||||
// ======================================================
|
||||
// 🔹 COMMON OPTION MODELS
|
||||
// ======================================================
|
||||
type DeptOption struct {
|
||||
Code string `json:"code"`
|
||||
Title string `json:"title,omitempty"`
|
||||
}
|
||||
|
||||
// Flexible JSON decode
|
||||
func (d *DeptOption) UnmarshalJSON(data []byte) error {
|
||||
|
||||
var raw struct {
|
||||
Code any `json:"code"`
|
||||
Title string `json:"title"`
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(data, &raw); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
d.Title = raw.Title
|
||||
|
||||
switch v := raw.Code.(type) {
|
||||
|
||||
case string:
|
||||
d.Code = v
|
||||
|
||||
case []any:
|
||||
if len(v) > 0 {
|
||||
if s, ok := v[0].(string); ok {
|
||||
d.Code = s
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
d.Code = ""
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type NebimOption struct {
|
||||
Username string `json:"username"`
|
||||
UserGroupCode string `json:"user_group_code"`
|
||||
}
|
||||
18
svc/models/user_list.go
Normal file
18
svc/models/user_list.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package models
|
||||
|
||||
// UserListRow — UserList.vue satır modeli (FINAL)
|
||||
type UserListRow struct {
|
||||
ID int64 `json:"id"`
|
||||
Code string `json:"code"`
|
||||
IsActive bool `json:"is_active"`
|
||||
|
||||
// Nebim eşleşmesi (ID yok)
|
||||
NebimUsername *string `json:"nebim_username,omitempty"`
|
||||
UserGroupCode *string `json:"user_group_code,omitempty"`
|
||||
|
||||
// UI’da gösterilecek toplu alanlar
|
||||
RoleNames string `json:"role_names"` // "ADMIN, USER"
|
||||
DepartmentNames string `json:"department_names"` // "UST YONETIM, ..."
|
||||
PiyasaNames string `json:"piyasa_names"` // "AVRUPA, LALELI"
|
||||
|
||||
}
|
||||
20
svc/models/users.go
Normal file
20
svc/models/users.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package models
|
||||
|
||||
type User struct {
|
||||
ID int `json:"id"`
|
||||
Username string `json:"username"`
|
||||
|
||||
IsActive bool `json:"is_active"`
|
||||
Email string `json:"email"`
|
||||
|
||||
RoleID int `json:"role_id"`
|
||||
RoleCode string `json:"role_code"`
|
||||
FullName string
|
||||
Mobile string
|
||||
Address string
|
||||
V3Username string `json:"v3_username"`
|
||||
V3UserGroup int `json:"v3_usergroup"`
|
||||
ForcePasswordChange bool `json:"force_password_change"`
|
||||
|
||||
Upass string // 🔐 dfusr.upass (TEK KAYNAK)
|
||||
}
|
||||
Reference in New Issue
Block a user