Skip to content

Instantly share code, notes, and snippets.

select *
from vw_ce_dms_transactions trans
left join datafiles_data plu
ON plu.datafiledataid = trans.PLUID
LEFT JOIN dbo.vw_ce_oms_order_header orh ON trans.WONo = orh.OrderNo
where trans.PLUID in (82275,83234,83804,83802)
and TransactionDateTime between '20200516' and '20200518'
and TransactionType like '%loading%'
Select
pl.code PluCode,
pl.Text1 Pludescription,
TUC,
Qty,
lds.LabelDesignCode
from
--(
--select
-- pluid,
SELECT p.PLUCode, p.PLUDescription,p.Text2,p.Text3,p.Text4,p.tuc,p.Active, s.SummationDescription, l.LabelDesignCode
FROM dbo.vw_df_plu_file p LEFT JOIN dbo.dcs_summations s ON p.PLUID = s.PLUID LEFT JOIN dbo.dcs_summations_label_designs l ON s.SummationID = l.SummationID
WHERE s.SummationDescription = 'Case' ORDER BY p.PLUCode
select orh.TraderCode as CustomerCode
,orh.TraderName as CustomerName
,plu.Code as PLUCode
,plu.Text1 as PLUDescription
,SUM(dms.NetWeight) as WGT
,SUM(dms.units) as Cases
from vw_ce_dms_transactions dms
left join datafiles_data plu
ON plu.datafiledataid = dms.PLUID
select SUM(trn.Units) as DispatchQty
select plu.Code
,plu.Text1
,orl.
,dispatchweight
@gdloughrey1
gdloughrey1 / associations issue
Created September 10, 2019 08:06
Associations issue
select *
from datafiles_data
where Code in ('6674','6678', '7575')
and datafileid = 104
SELECT datafile_associations_data.AssociationID
,datafile_associations_data.DatafileDataID1 -- CustomerID
,datafile_associations_data.DatafileDataID2 -- DepotID
,datafile_associations_data.Properties
FROM datafile_associations_data
@gdloughrey1
gdloughrey1 / count so created by
Created February 21, 2019 09:55
count so created by
select count(WONo), WOCreatedBy
from vw_ce_oms_wo_header
where WOType = 'SO'
and WOVersion = 0
and WOCreatedTimestamp between '20181001' and '20190221'
group by WOCreatedBy
@gdloughrey1
gdloughrey1 / Halesowen trace for exchange msg
Created June 14, 2018 16:13
Halesowen trace for exchange msg
select distinct transactiontype
from vw_ce_dms_transactions
where TransactionDateTime > '20180601'
select *
from vw_ce_dms_transactions
where TransactionDateTime > '20180601'
and TransactionType='BOX_PACKING'
select *
@gdloughrey1
gdloughrey1 / QC Label
Created February 28, 2018 09:35
QC Label SP
USE [iWAMS_DMS_DUNBIA_DGN_RET_LAB]
GO
/****** Object: StoredProcedure [Dunbia].[ReportProductionPackingQCLabelSummary] Script Date: 06/02/2017 10:48:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
@gdloughrey1
gdloughrey1 / sscc padding
Created February 28, 2018 09:34
sscc padding asn
SELECT LEN('16790000022722') --14
SELECT 17 - LEN('16790000022722') --3
SELECT REPLICATE('0', 17 - LEN('16790000022722')) --000
SELECT STUFF('16790000022722', 1, 0, REPLICATE('0', 17 - LEN('16790000022722'))) --00016790000022722
SELECT [dbo].[fnGetSSCC](STUFF('16790000022722', 1, 0, REPLICATE('0', 17 - LEN('16790000022722')))) --000167900000227220