Fix product performance grouped JSON build
This commit is contained in:
@@ -908,6 +908,7 @@ func GetProductionHasCostProducts(
|
|||||||
search string,
|
search string,
|
||||||
offset int,
|
offset int,
|
||||||
limit int,
|
limit int,
|
||||||
|
nFirmaID int,
|
||||||
) (*sql.Rows, error) {
|
) (*sql.Rows, error) {
|
||||||
search = strings.TrimSpace(search)
|
search = strings.TrimSpace(search)
|
||||||
|
|
||||||
@@ -998,6 +999,7 @@ OUTER APPLY (
|
|||||||
)
|
)
|
||||||
) CM
|
) CM
|
||||||
WHERE OM.rn = 1
|
WHERE OM.rn = 1
|
||||||
|
AND (@p4 <= 0 OR ISNULL(OM.nFirmaID, 0) = @p4)
|
||||||
AND (
|
AND (
|
||||||
@p1 = ''
|
@p1 = ''
|
||||||
OR RTRIM(CONVERT(VARCHAR(32), ISNULL(OM.nOnMLNo, 0))) LIKE '%' + @p1 + '%'
|
OR RTRIM(CONVERT(VARCHAR(32), ISNULL(OM.nOnMLNo, 0))) LIKE '%' + @p1 + '%'
|
||||||
@@ -1012,7 +1014,7 @@ OFFSET @p2 ROWS
|
|||||||
FETCH NEXT @p3 ROWS ONLY
|
FETCH NEXT @p3 ROWS ONLY
|
||||||
`
|
`
|
||||||
|
|
||||||
return uretimDB.QueryContext(ctx, sqlText, search, offset, limit)
|
return uretimDB.QueryContext(ctx, sqlText, search, offset, limit, nFirmaID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetProductionHasCostHistoryByProductCode(
|
func GetProductionHasCostHistoryByProductCode(
|
||||||
|
|||||||
@@ -197,11 +197,12 @@ func GetProductionHasCostProductsHandler(w http.ResponseWriter, r *http.Request)
|
|||||||
search := strings.TrimSpace(r.URL.Query().Get("search"))
|
search := strings.TrimSpace(r.URL.Query().Get("search"))
|
||||||
offset := parsePositiveIntOrDefault(r.URL.Query().Get("offset"), 0)
|
offset := parsePositiveIntOrDefault(r.URL.Query().Get("offset"), 0)
|
||||||
limit := parsePositiveIntOrDefault(r.URL.Query().Get("limit"), 300)
|
limit := parsePositiveIntOrDefault(r.URL.Query().Get("limit"), 300)
|
||||||
|
nFirmaID, _ := strconv.Atoi(strings.TrimSpace(r.URL.Query().Get("n_firma_id")))
|
||||||
if limit > 1000 {
|
if limit > 1000 {
|
||||||
limit = 1000
|
limit = 1000
|
||||||
}
|
}
|
||||||
|
|
||||||
rows, err := queries.GetProductionHasCostProducts(r.Context(), uretimDB, search, offset, limit)
|
rows, err := queries.GetProductionHasCostProducts(r.Context(), uretimDB, search, offset, limit, nFirmaID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("❌ [ProductionHasCost] query error: %v", err)
|
log.Printf("❌ [ProductionHasCost] query error: %v", err)
|
||||||
http.Error(w, "Veritabanı hatası", http.StatusInternalServerError)
|
http.Error(w, "Veritabanı hatası", http.StatusInternalServerError)
|
||||||
|
|||||||
@@ -142,9 +142,11 @@
|
|||||||
outline
|
outline
|
||||||
class="pcd-toolbar-btn"
|
class="pcd-toolbar-btn"
|
||||||
:loading="firmCostHistoryLoading"
|
:loading="firmCostHistoryLoading"
|
||||||
:disable="!detailHeader || detailLoading || saveLoading || bulkPriceLoading"
|
:disable="!detailHeader || detailLoading || saveLoading || bulkPriceLoading || !currentFirmaID"
|
||||||
@click="openFirmCostHistoryDialog"
|
@click="openFirmCostHistoryDialog"
|
||||||
/>
|
>
|
||||||
|
<q-tooltip v-if="!currentFirmaID">Uretimi yapan firma bilgisi bulunamadi</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -707,7 +709,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<div class="text-subtitle1 text-weight-bold">Malzemeleri Onceki Maliyetlerden Kopyala</div>
|
<div class="text-subtitle1 text-weight-bold">Malzemeleri Onceki Maliyetlerden Kopyala</div>
|
||||||
<div class="text-caption text-grey-7">
|
<div class="text-caption text-grey-7">
|
||||||
HasCost listesinden bir maliyet secin. Yalnizca bos olan TP/DT gruplari aktarilir.
|
Uretimi yapan firmaya ait HasCost listesinden bir maliyet secin. Yalnizca bos olan TP/DT gruplari aktarilir.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<q-btn flat round dense icon="close" v-close-popup />
|
<q-btn flat round dense icon="close" v-close-popup />
|
||||||
@@ -1447,6 +1449,7 @@ const isNoCostDetail = computed(() => detailSource.value === 'no-cost')
|
|||||||
const generatedTraceId = ref(createTraceId('pcd-detail'))
|
const generatedTraceId = ref(createTraceId('pcd-detail'))
|
||||||
const traceId = computed(() => String(route.query?.trace_id || generatedTraceId.value).trim())
|
const traceId = computed(() => String(route.query?.trace_id || generatedTraceId.value).trim())
|
||||||
const pageMode = computed(() => (isNoCostDetail.value ? 'new' : 'edit'))
|
const pageMode = computed(() => (isNoCostDetail.value ? 'new' : 'edit'))
|
||||||
|
const currentFirmaID = computed(() => parseInt(String(detailHeader.value?.nFirmaID || detailHeader.value?.NFirmaID || '0').trim(), 10) || 0)
|
||||||
const pageVars = computed(() => ({
|
const pageVars = computed(() => ({
|
||||||
'--pcd-subheader-top': `${subHeaderTop.value}px`
|
'--pcd-subheader-top': `${subHeaderTop.value}px`
|
||||||
}))
|
}))
|
||||||
@@ -5036,6 +5039,11 @@ function isTPDTGroupName (value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function openFirmCostHistoryDialog () {
|
async function openFirmCostHistoryDialog () {
|
||||||
|
if (!currentFirmaID.value) {
|
||||||
|
$q.notify({ type: 'warning', message: 'Uretimi yapan firma bilgisi bulunamadi.', position: 'top-right' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
firmCostHistoryDialogOpen.value = true
|
firmCostHistoryDialogOpen.value = true
|
||||||
firmCostHistoryLoading.value = true
|
firmCostHistoryLoading.value = true
|
||||||
firmCostHistoryError.value = ''
|
firmCostHistoryError.value = ''
|
||||||
@@ -5047,6 +5055,7 @@ async function openFirmCostHistoryDialog () {
|
|||||||
search: '',
|
search: '',
|
||||||
offset: 0,
|
offset: 0,
|
||||||
limit: 1000,
|
limit: 1000,
|
||||||
|
n_firma_id: currentFirmaID.value,
|
||||||
trace_id: traceId.value
|
trace_id: traceId.value
|
||||||
})
|
})
|
||||||
const currentNo = parseInt(String(onMLNo.value || detailHeader.value?.nOnMLNo || '0'), 10) || 0
|
const currentNo = parseInt(String(onMLNo.value || detailHeader.value?.nOnMLNo || '0'), 10) || 0
|
||||||
|
|||||||
Reference in New Issue
Block a user