using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace POSV { public class SqlConstant { /// /// 按指定Group获取系统参数 /// public const string ConfigQueryAllToDictionary = "select [keys],[values] from [pos_config];"; /// /// 按指定Key获取系统参数 /// pos_config /// public const string ConfigQueryByGroupAndKey = "select [id],[tenantId],[group],[keys],[values],[createUser],[createDate],[modifyUser],[modifyDate] from [pos_config] where [group] = '{0}' and [keys] = '{1}';"; /// /// 按指定Group获取系统参数 /// public const string ConfigQueryByGroupToDictionary = "select [keys],[values] from [pos_config] where [group] = '{0}';"; /// /// 查询POS指纹信息 /// public const string AuthcQueryAll = "SELECT id, tenantId, compterName, macAddress, diskSerialNumber, cpuSerialNumber, storeId, storeNo, storeName, posNo, ext1, ext2, ext3, createUser, createDate, modifyUser, modifyDate FROM pos_authc;"; /// /// 查询全部API接口 /// public const string ApisQueryAll = "SELECT id, tenantId, apiType, appKey, appSecret, locale, format, client, version, routing, memo, ext1, ext2, ext3, createUser, createDate, modifyUser, modifyDate FROM pos_apis;"; /// /// 查询API对应的URL数据 /// public const string UrlsQueryAll = "SELECT id, tenantId, apiType, protocol, url, contextPath, userDefined, enable, memo, ext1, ext2, ext3, createUser, createDate, modifyUser, modifyDate FROM pos_urls;"; /// /// 商品组合信息 /// //public const string ProductExtAll = @"select p.*,t.name as typeName,u.name as unitName,s.name as specName,s.id as specId ,k.chuda,k.chudaFlag,k.chupin,k.chupinFlag from pos_product p // left join pos_product_unit u on p.unitId = u.id // left join pos_product_type t on p.typeId = t.id // left join pos_kit_product k on p.id = k.productId // left join // ( // select sp.* , sps.* from // (select productId, min(no) as minNo from pos_product_spec group by productId) sps // left join pos_product_spec sp on(sps.productId = sp.productId and sp.no = sps.minNo) // ) s on s.productId = p.id "; //要货 public const string YHProductExt = @"select a.tenantId, a.id as productId,b.id as specId,a.name as productName,a.no as productNo, b.name as specName,d.dispatchUnitId,c.name as dispatchUnitName,a.spell,a.memo,d.packUnitId,e.name as packUnitName from pos_product a LEFT JOIN pos_product_spec b on b.productId = a.id LEFT JOIN pos_product_ratio d on d.productId = a.id LEFT JOIN pos_product_unit c on c.id = d.dispatchUnitId LEFT JOIN pos_product_unit e on e.id = d.packUnitId where a.stopFlag=0 and a.stockFlag = 1 and b.deleteFlag = 0"; //成品销售,外卖查找 public const string ProductExt = @"select p.[id],p.[tenantId],p.[brandId],p.[typeId],p.[typePath],p.[no],p.[name],p.[shortName],p.[spell],p.[assistNo],p.[otherNo],p.[barCode],p.[english],p.[unitId],p.[memo],p.[commissionType],p.[commissionValue],p.[discountFlag],p.[suitFlag],p.[tapleFlag],p.[weighFlag],p.[currentFlag],p.[labelPrintFlag],p.[stopFlag],p.[groupName],p.[picture],p.[mebDiscountFlag],p.[giveFlag],p.[promotionFlag],p.[type],p.[stockFlag],p.[pointType],p.[pointValue],p.[purchaseTax],p.[saleTax],p.[lyRate],p.[specCount],p.[ext1],p.[ext3],p.[ext2],p.[createUser],p.[createDate],p.[modifyUser],p.[modifyDate],t.name as typeName,u.name as unitName,s.name as specName,s.id as specId ,k.chuda,k.chudaFlag,k.chupin,k.chupinFlag ,k.[labelFlag] as chuDaLabelFlag, k.[labelValue] as chuDaLabel, s.[price],s.[memberPrice],s.[otherPrice],s.[costPrice],s.[purchasePrice],s.[dispatchPrice],s.[minPrice],d.[chuxian],d.[chuxianFlag],d.[chuxianTime],d.[chupin] as kdsChupin,d.[chupinFlag] as kdsChupinFlag,d.[chupinTime] as kdsChupinTime from pos_product p left join pos_product_unit u on p.unitId = u.id left join pos_product_type t on p.typeId = t.id left join pos_kit_product k on p.id = k.productId left join pos_kds_product d on p.id = d.productId left join pos_product_spec s on s.productId = p.id"; public const string ProductExtAll = @"select p.[id],p.[tenantId],p.[brandId],p.[typeId],p.[typePath],p.[no],p.[name],p.[shortName],p.[spell],p.[assistNo],p.[otherNo],p.[barCode],p.[english],p.[unitId],p.[memo],p.[commissionType],p.[commissionValue],p.[discountFlag],p.[suitFlag],p.[tapleFlag],p.[weighFlag],p.[currentFlag],p.[labelPrintFlag],p.[stopFlag],p.[groupName],p.[picture],p.[mebDiscountFlag],p.[giveFlag],p.[promotionFlag],p.[type],p.[stockFlag],p.[pointType],p.[pointValue],p.[purchaseTax],p.[saleTax],p.[lyRate],p.[specCount],p.[ext1],p.[ext3],p.[ext2],p.[createUser],p.[createDate],p.[modifyUser],p.[modifyDate],t.name as typeName,u.name as unitName,s.name as specName,s.id as specId ,k.chuda,k.chudaFlag,k.chupin,k.chupinFlag ,k.[labelFlag] as chuDaLabelFlag, k.[labelValue] as chuDaLabel,s.[price],s.[memberPrice],s.[otherPrice],s.[costPrice],s.[purchasePrice],s.[dispatchPrice],s.[minPrice],d.[chuxian],d.[chuxianFlag],d.[chuxianTime],d.[chupin] as kdsChupin,d.[chupinFlag] as kdsChupinFlag,d.[chupinTime] as kdsChupinTime, p.[kdsFlag] from pos_product p left join pos_product_unit u on p.unitId = u.id left join pos_product_type t on p.typeId = t.id left join pos_kit_product k on p.id = k.productId left join pos_kds_product d on p.id = d.productId left join ( select sp.* , sps.* from (select productId, min(no) as minNo from pos_product_spec where deleteFlag = 0 group by productId) sps left join pos_product_spec sp on(sps.productId = sp.productId and sp.no = sps.minNo) where sp.deleteFlag = 0 ) s on s.productId = p.id WHERE p.`type` >= 0 AND p.`type` <= 9 AND p.`stopFlag` = 0 and s.id is not null "; public const string SuitExt = @"select p.[id],p.[tenantId],p.[brandId],p.[typeId],p.[typePath],p.[no],p.[name],p.[shortName],p.[spell],p.[assistNo],p.[otherNo],p.[barCode],p.[english],p.[unitId],p.[memo],p.[commissionType],p.[commissionValue],p.[discountFlag],p.[suitFlag],p.[tapleFlag],p.[weighFlag],p.[currentFlag],p.[labelPrintFlag],p.[stopFlag],p.[groupName],p.[picture],p.[mebDiscountFlag],p.[giveFlag],p.[promotionFlag],p.[type],p.[stockFlag],p.[pointType],p.[pointValue],p.[purchaseTax],p.[saleTax],p.[lyRate],p.[specCount],p.[ext1],p.[ext3],p.[ext2],p.[createUser],p.[createDate],p.[modifyUser],p.[modifyDate],pt.name as typeName,u.name as unitName,d.suitId,d.productId,d.suitProductId,d.specId,d.defaultFlag,d.quantity,d.addPrice,s.name as specName,k.chuda,k.chudaFlag,k.chupin,k.chupinFlag,k.[labelFlag] as chuDaLabelFlag, k.[labelValue] as chuDaLabel,s.[price],s.[memberPrice],s.[otherPrice],s.[costPrice],s.[purchasePrice],s.[dispatchPrice],s.[minPrice],kds.[chuxian],kds.[chuxianFlag],kds.[chuxianTime],kds.[chupin] as kdsChupin,kds.[chupinFlag] as kdsChupinFlag,kds.[chupinTime] as kdsChupinTime from pos_product_suitdetail d left join pos_product p on d.productId = p.id left join pos_product_type pt on p.typeId = pt.id left join pos_product_unit u on p.unitId = u.id left join pos_product_spec s on d.specId = s.id left join pos_product_suit t on d.suitId = t.id left join pos_kit_product k on p.id = k.productId left join pos_kds_product kds on p.id = kds.productId where t.productId = '{0}' order by t.no asc;"; public const string SuitExt1 = @"select p.[id],p.[tenantId],p.[brandId],p.[typeId],p.[typePath],p.[no],p.[name],p.[shortName],p.[spell],p.[assistNo],p.[otherNo],p.[barCode],p.[english],p.[unitId],p.[memo],p.[commissionType],p.[commissionValue],p.[discountFlag],p.[suitFlag],p.[tapleFlag],p.[weighFlag],p.[currentFlag],p.[labelPrintFlag],p.[stopFlag],p.[groupName],p.[picture],p.[mebDiscountFlag],p.[giveFlag],p.[promotionFlag],p.[type],p.[stockFlag],p.[pointType],p.[pointValue],p.[purchaseTax],p.[saleTax],p.[lyRate],p.[specCount],p.[ext1],p.[ext3],p.[ext2],p.[createUser],p.[createDate],p.[modifyUser],p.[modifyDate],pt.name as typeName,u.name as unitName,d.suitId,d.productId,d.suitProductId,d.specId,d.defaultFlag,d.quantity,d.addPrice,s.name as specName,k.chuda,k.chudaFlag,k.chupin,k.chupinFlag,k.[labelFlag] as chuDaLabelFlag, k.[labelValue] as chuDaLabel,s.[price],s.[memberPrice],s.[otherPrice],s.[costPrice],s.[purchasePrice],s.[dispatchPrice],s.[minPrice],kds.[chuxian],kds.[chuxianFlag],kds.[chuxianTime],kds.[chupin] as kdsChupin,kds.[chupinFlag] as kdsChupinFlag,kds.[chupinTime] as kdsChupinTime from pos_product_suitdetail d left join pos_product p on d.productId = p.id left join pos_product_type pt on p.typeId = pt.id left join pos_product_unit u on p.unitId = u.id left join pos_product_spec s on d.specId = s.id left join pos_product_suit t on d.suitId = t.id left join pos_kit_product k on p.id = k.productId left join pos_kds_product kds on p.id = kds.productId where t.productId = '{0}' and d.suitId='{1}' and p.name like '%{2}%' order by t.no asc;"; public const string TableExtAll = @"select t.* , e.* from pos_table t left join pos_table_ext e on t.id = e.tableId where 1=1 "; /// /// 根据规格ID获取商品清单 /// /// zhangy 2020-04-23 Add 解决美团券核销查询商品的问题 /// public const string ProductExtBySpecIds = @"select p.[id],p.[tenantId],p.[brandId],p.[typeId],p.[typePath],p.[no],p.[name],p.[shortName],p.[spell],p.[assistNo],p.[otherNo],p.[barCode],p.[english],p.[unitId],p.[memo],p.[commissionType],p.[commissionValue],p.[discountFlag],p.[suitFlag],p.[tapleFlag],p.[weighFlag],p.[currentFlag],p.[labelPrintFlag],p.[stopFlag],p.[groupName],p.[picture],p.[mebDiscountFlag],p.[giveFlag],p.[promotionFlag],p.[type],p.[stockFlag],p.[pointType],p.[pointValue],p.[purchaseTax],p.[saleTax],p.[lyRate],p.[specCount],p.[ext1],p.[ext3],p.[ext2],p.[createUser],p.[createDate],p.[modifyUser],p.[modifyDate],t.name as typeName,u.name as unitName,s.name as specName,s.id as specId ,k.chuda,k.chudaFlag,k.chupin,k.chupinFlag ,k.[labelFlag] as chuDaLabelFlag, k.[labelValue] as chuDaLabel,s.[price],s.[memberPrice],s.[otherPrice],s.[costPrice],s.[purchasePrice],s.[dispatchPrice],s.[minPrice],d.[chuxian],d.[chuxianFlag],d.[chuxianTime],d.[chupin] as kdsChupin,d.[chupinFlag] as kdsChupinFlag,d.[chupinTime] as kdsChupinTime, p.[kdsFlag] from pos_product p left join pos_product_unit u on p.unitId = u.id left join pos_product_type t on p.typeId = t.id left join pos_kit_product k on p.id = k.productId left join pos_kds_product d on p.id = d.productId left join pos_product_spec s on p.id = s.productId where s.deleteFlag = 0 and s.id in ({0})"; } }