Skip to content

Instantly share code, notes, and snippets.

@gdloughrey1
gdloughrey1 / mds issue
Created February 8, 2018 10:42
MDS issue
select *
from vw_df_plu_file
where PLUCode=PLUDescription
and Active=1
@gdloughrey1
gdloughrey1 / ims locations
Created February 28, 2018 09:34
Vw_df_ims_locations
SELECT dbo.datafiles_data.DatafileDataID AS LocationID, CAST(SUBSTRING(dbo.datafiles_data.Code, 1, 2) AS INT) AS LocationWarehouseCode,
dbo.datafiles_data.Code AS LocationCode, dbo.datafiles_data.Text1 AS LocationDescription, dbo.datafiles_data.Text2 AS LocationProperties,
dbo.datafiles_data.Text4 AS LocationType
FROM dbo.datafiles_data INNER JOIN
dbo.datafiles ON dbo.datafiles_data.DatafileID = dbo.datafiles.DatafileID
WHERE (dbo.datafiles.Name = 'IMS_LOCATIONS') AND (dbo.datafiles_data.Active = 1)
@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
@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 / 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 / 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 / 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
select SUM(trn.Units) as DispatchQty
select plu.Code
,plu.Text1
,orl.
,dispatchweight
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 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