File:cn/goods.htm
Method:query.scalar(columns,*where,*order)
'WHERE' 附近有语法错误。
select top 1 GoodsId FROM cpgoods WHERE
数据库执行错误
cn/xmls/goods.xmls
$sub main(){
$shell.call($get(method));
}
//标题
$sub start(){
@querygoods=$query(goods,goods);
@querygoods[GuId]=$argv(0,$null);
@GoodsName=@querygoods.scalar(['GoodsName'],['{*GuId =} and {*AreaId = $shell.getData(cn)}']);
@EnGoodsName=@querygoods.scalar(['EnGoodsName'],['{*GuId =} and {*AreaId = $shell.getData(cn)}']);
@CAS=@querygoods.scalar(['CAS'],['{*GuId =} and {*AreaId = $shell.getData(cn)}']);
@AnotherName=@querygoods.scalar(['AnotherName'],['{*GuId =} and {*AreaId = $shell.getData(cn)}']);
@EnAnotherName=@querygoods.scalar(['EnAnotherName'],['{*GuId =} and {*AreaId = $shell.getData(cn)}']);
@Detail1=@querygoods.scalar(['Detail1'],['{*GuId =} and {*AreaId = $shell.getData(cn)}']);
@Detail2=@querygoods.scalar(['Detail2'],['{*GuId =} and {*AreaId = $shell.getData(cn)}']);
@MDL=@querygoods.scalar(['MDL'],['{*GuId =} and {*AreaId = $shell.getData(cn)}']);
$if(@GoodsName){
@Name=$join(@GoodsName,|,@EnGoodsName,|,@CAS,|,@MDL);
}
$else{
@Name=产品详情;
}
$shell[Title]=$join(@Name,-,$shell.getData(metaTitle));
$shell[keywords]=$join(@AnotherName,|,@EnAnotherName);
$shell[description]=$join(@Detail1,|,@Detail2);
$return($empty);
}
//导航列表
$sub catalogList(classA,Subgrade){
@querygcata=$query(catalog,goods);
@CatalogId=$argv(0,$null);
@map=$map();
$if(@CatalogId){
@CatalogPath=[",{@CatalogId},"];
@querygcata[CatalogId]=@CatalogId;
@map[parentName]=@querygcata.scalar(CatalogName,['{*CatalogId =} and {*AreaId = $shell.getData(cn)}']);
$if($argv(0,$null)==0){
@map[parentName]=产品分类;
}
}
$else{
@CatalogPath=$null;
@map[parentName]=产品分类;
}
@tablectmn=@querygcata.table(*,['ParentId=0 and Status>0 and {*AreaId = $shell.getData(cn)}'],['Grade desc,CatalogId desc']);
@listta=@tablectmn.format(@classA){
@tablect=@querygcata.table(*,['{*ParentId = $var[CatalogId]} and Status>0'],['Grade desc,CatalogId desc']);
@listtb=@tablect.format(@Subgrade);
}
@listta.append(["<li><h6><a class="block c-6" href="{~goods-list/0_1}">推荐产品</a></h6></li><li><h6><a class="block c-6" href="{~goods-list/0_2}">新型散装产品</a></h6></li>"]);
@map[listta]=$string(@listta);
$shell.put(@map);
$return($empty);
}
//产品列表
$sub goodsPage(Pcformat,Moformat,Pager,Prompt,TagIds){
@map=$map();
@querygoods=$query(goods,goods);
@Method=$get(Method,$null);
@keywords=$get(keywords,$null);
@Type=$get(Type,$null);
@CatalogId=$argv(0,$null);
$if(@CatalogId){
@CatalogPath=[",{@CatalogId},"];
}
$else{
@CatalogPath=$null;
}
$if(@Method==batch){
$if(@Type==Goods){
@querygoods[GoodsCode]=@keywords;
@where=['Status>0 and {*AreaId = $shell.getData(cn)} and {*GoodsCode in}'];
}
$elseif(@Type==CAS){
@querygoods[CAS]=$join(0-0-0\,,@keywords);
@where=['Status>0 and {*AreaId = $shell.getData(cn)} and {*CAS in}'];
}
$elseif(@Type==Gname){
@querygoods[EnGoodsName]=@keywords;
@where=['Status>0 and {*AreaId = $shell.getData(cn)} and {*EnGoodsName in}'];
}
$elseif(@Type==Smiles){
@Sea=$get(Sea);
$if(@Sea==0){
@querygoods[Smiles]=@keywords;
@where=['Status>0 and {*AreaId = $shell.getData(cn)} and {*Smiles =}'];
}
$elseif(@Sea==1){
@querygoods[Smiles]=@keywords;
@where=['Status>0 and {*AreaId = $shell.getData(cn)} and {*Smiles like}'];
}
$else{
@querygoods[CatalogPath]=@CatalogPath;
@where=['Status>0 and {*AreaId = $shell.getData(cn)} {?} and {*CatalogPath like}'];
}
}
$else{
@querygoods[CatalogPath]=@CatalogPath;
@where=['Status>0 and {*AreaId = $shell.getData(cn)} {?} and {*CatalogPath like}'];
}
}
$else{
$if(@keywords<>$null){
@querygoods[GoodsName]=@keywords;
@querygoods[EnGoodsName]=@keywords;
@querygoods[CAS]=@keywords;
@querygoods[MDL]=@keywords;
@querygoods[MW]=@keywords;
@querygoods[MF]=@keywords;
@querygoods[GoodsCode]=@keywords;
@querygoods[BrandName]=@keywords;
@where=['Status>0 and {*AreaId = $shell.getData(cn)} {?} and ({*GoodsName like} or {*EnGoodsName like} or {*CAS like} or {*MDL like} or {*MW like} or {*MF like} or {*GoodsCode like} or {*BrandName like})'];
}
$else{
$if($argv(0,$null)<>0){
@querygoods[CatalogPath]=@CatalogPath;
}
$if($argv(1,$null)){
@querygoods[TagIds]=[",{$argv(1)},"];
}
@where=['Status>0 and {*AreaId = $shell.getData(cn)} {?and} {*TagIds like} {?and} {*CatalogPath like} {?)}'];
}
}
@wheres=@querygoods.sql(@where);
@goodslist=@querygoods.pager(['GoodsName,GoodsId,Guid,CAS,EnGoodsName,GoodsCode,MW,MF,MDL,BrandName,Grade'],@wheres,['Grade desc,GoodsId desc'],4,$argv(2,1));
@PCcoent=@goodslist.format(@Pcformat);
@Mocoent=@goodslist.format(@Moformat);
@map[pcCoent]=@PCcoent;
@map[moCoent]=@Mocoent;
@map[pager]=$helper.pager(@Pager,4,@count,$argv(2,1),#2,3);
@map[count]=@count;
$if(@count==0){
@map[pcCoent]=@Prompt;
@map[moCoent]=@Prompt;
@map[pager]=$empty;
}
$shell.put(@map);
$return($empty);
}
$sub searchPage(Pcformat,Moformat,Pager,Prompt,TagIds){
@map=$map();
@querygoods=$query(goods,goods);
@Method=$get(Method,$null);
@keywords=$get(keywords,$null);
@Type=$get(Type,$null);
@CatalogId=$argv(0,$null);
$if(@CatalogId){
@CatalogPath=[",{@CatalogId},"];
}
$else{
@CatalogPath=$null;
}
$if(@Method==batch){
$if(@Type==Goods){
@querygoods[GoodsCode]=@keywords;
@where=['Status>0 and {*AreaId = $shell.getData(cn)} and {*GoodsCode in}'];
}
$elseif(@Type==CAS){
@querygoods[CAS]=$join(0-0-0\,,@keywords);
@where=['Status>0 and {*AreaId = $shell.getData(cn)} and {*CAS in}'];
}
$elseif(@Type==Gname){
@querygoods[EnGoodsName]=@keywords;
@where=['Status>0 and {*AreaId = $shell.getData(cn)} and {*EnGoodsName in}'];
}
$elseif(@Type==Smiles){
@Sea=$get(Sea);
$if(@Sea==0){
@querygoods[Smiles]=@keywords;
@where=['Status>0 and {*AreaId = $shell.getData(cn)} and {*Smiles =}'];
}
$elseif(@Sea==1){
@querygoods[Smiles]=@keywords;
@where=['Status>0 and {*AreaId = $shell.getData(cn)} and {*Smiles like}'];
}
$else{
@querygoods[CatalogPath]=@CatalogPath;
@where=['Status>0 and {*AreaId = $shell.getData(cn)} {?} and {*CatalogPath like}'];
}
}
$else{
@querygoods[CatalogPath]=@CatalogPath;
@where=['Status>0 and {*AreaId = $shell.getData(cn)} {?} and {*CatalogPath like}'];
}
}
$else{
$if(@keywords<>$null){
@querygoods[GoodsName]=@keywords;
@querygoods[EnGoodsName]=@keywords;
@querygoods[CAS]=@keywords;
@querygoods[MDL]=@keywords;
@querygoods[MW]=@keywords;
@querygoods[MF]=@keywords;
@querygoods[GoodsCode]=@keywords;
@querygoods[BrandName]=@keywords;
@where=['Status>0 and {*AreaId = $shell.getData(cn)} {?} and ({*GoodsName like} or {*EnGoodsName like} or {*CAS like} or {*MDL like} or {*MW like} or {*MF like} or {*GoodsCode like} or {*BrandName like})'];
}
$else{
$if($argv(0,$null)<>0){
@querygoods[CatalogPath]=@CatalogPath;
}
$if($argv(1,$null)){
@querygoods[TagIds]=[",{$argv(1)},"];
}
$else{
@querygoods[TagIds]=[",{@TagIds},"];
}
@where=['Status>0 and {*AreaId = $shell.getData(cn)} {?and} {*TagIds like} {?and} {*CatalogPath like} {?)}'];
}
}
@wheres=@querygoods.sql(@where);
@goodslist=@querygoods.pager(['GoodsName,GoodsId,Guid,CAS,EnGoodsName,GoodsCode,MW,MF,MDL,BrandName,Grade'],@wheres,['Grade desc,GoodsId desc'],4,$get(page,1));
@PCcoent=@goodslist.format(@Pcformat);
@Mocoent=@goodslist.format(@Moformat);
@map[pcCoent]=@PCcoent;
@map[moCoent]=@Mocoent;
@map[pager]=$helper.pager(@Pager,4,@count,$get(page,1),page,3);
@map[count]=@count;
$if(@count==0){
@map[pcCoent]=@Prompt;
@map[moCoent]=@Prompt;
@map[pager]=$empty;
}
$shell.put(@map);
$return($empty);
}
$ajax Itemlist(){
@formatitem=[#
<li class="fl"><span class="c-0d">{*GoodsCode}-{*ItemName}</span></li>
<li class="fl"><a title="{*Purity}">{#left(Purity,10,...)}</a></li>
<li class="fl tedec">¥ {*Price}</li>
<li class="fl"><span class="c-fb">¥ {*Price}</span></li>
<li class="fl">{*Description}</li>
<li class="fl">
<div class="inline sljjbox">
<a class="fl" href="javascript:ListQuantity(-1,document.getElementById('{*ItemId}Item'));">-</a>
<input class="fl" id="{*ItemId}Item" onblur="checkServis(this)" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\\d]/g,''))" onkeyup="value=value.replace(/[^\\d]/g,'')" type="text" value="0" maxlength="5" name="ItemName" data-item="{*ItemId}" Stock="1"/>
<a class="fl" href="javascript:ListQuantity(1,document.getElementById('{*ItemId}Item'));">+</a>
</div>
</li>
#];
@queryitem=$query(item,goods);
@UserId=$session.get(UserId,$null);
@queryitem[GoodsCode]=$post(GoodsCode);
@itemtable=@queryitem.table(['ItemId,GoodsCode,ItemName,Price,Description,Purity'],['{*GoodsCode =}'],['ItemId desc']);
@itemlist=@itemtable.format(@formatitem){
$if(@UserId){
@Goodsmprice();
}
$else{
@price=$var[Price];
}
@Price=$number.round(@price,2);
}
$write(@itemlist);
}
//优惠价
$sub Goodsmprice(){
@querygoods=$query(goods,goods);
@querycata=$query(catalog,goods);
@queryitem=$query(item,goods);
@querybrand=$query(brand,goods);
@querypro=$query(promotion,promotion);
@protb=@querypro.dataTable(['select PromotionId,Amount,Multiple,RuleType,UserGrade,PromotionRank from {#0} where getdate()>=StartTime and getdate()<=EndTime and Status=1 order by PromotionId desc']);
//产品信息
@querygoods[GoodsCode]=$var[GoodsCode];
@goodsMap=@querygoods.map(['GoodsName,Pic,BrandName,CatalogId'],['GoodsCode={*GoodsCode} or CAS={*GoodsCode}']);
//分类信息
$if(@goodsMap[CatalogId]<>0){
@querycata[CatalogId]=@goodsMap[CatalogId];
@cataMap=@querycata.map(['PromotionIds'],['CatalogId={*CatalogId}']);
}
$else{
@cataMap=$map();
@cataMap[PromotionIds]=$empty;
}
//规格信息
@queryitem[ItemId]=$var[ItemId];
@itemMap=@queryitem.map(['Price,GoodsCode,PromotionIds,ItemName,BrandName'],['ItemId={*ItemId}']);
//品牌信息
@querybrand[BrandName]=@itemMap[BrandName];
@brandMap=@querybrand.map(['BrandId,PromotionIds'],['BrandName={*BrandName}']);
$if(@brandMap==$null){
@brandMap=$map();
}
@queryuser=$query(user,user);
@queryuser[UserId]=@UserId;
@userMap=@queryuser.map(['UserGrade'],['UserId={*UserId}']);
$if(!@userMap){
@userMap[UserGrade]=0;
}
@pro=$call(~apps/user/shopcart.xmls);
@pro.getPormotion($empty,$empty,$empty,@itemMap[Price],1,@userMap[UserGrade]);
}
//产品详情
$sub viewGoods(){
@queryGoods=$query(goods,goods);
@Guid=$argv(0);
@queryGoods[CAS]=@Guid;
@rowGoods=@queryGoods.map(*,['{*CAS =}']);
$if(!@rowGoods){
$write.error();
$end();
}
@TDD=@rowGoods[Pic];
@srcc=["/files/images/goods/{@TDD}.png"];
//判断图片是否存在
@pic=@rowGoods[CAS];
$if(@pic<>$null){
@src=["/files/images/goods/{@pic}.png"];
$if($file.existsFile($file.getMapPath(@src))==1){
@picc=["{@src}"];
}
$else{
@picc=["/files/images/fande.png"];
}
}
//安全图片
@GHS=$string(@rowGoods[Pictogram]);
@gimg=$string();
@GHSs=@GHS.split(\,);
@GHSs.foreach(){
@var=$var[value];
$if(@var){
@gimg.append(["<img src='../../files/GHS/{@var}.jpg' class='Ghs'/>"]);
}
}
@queryGoods[GoodsId]=@rowGoods[GoodsId];
@queryGoods.setField($field(Click,Click+1,object));
@queryGoods.update();
@rowGoods[Gimg]=@gimg;
$shell.put(@rowGoods);
$return($empty);
}
//规格
$sub formatGoodsItem(format){
@UserId=$session[UserId];
@queryItem=$query(item,goods);
@queryItem[GoodsCode]=$argv(0,$null);
@queryItem[CAS]=$argv(0,$null);
@GoodsCode=@queryItem.dataScalar(['select GoodsCode from cpgoods where CAS='{$argv(0)}'']);
@tableItem=@queryItem.table(*,['GoodsCode='{@GoodsCode}''],['ItemId desc']);
//@tableItem=@queryItem.table(*,['{*GoodsCode =} or {*CAS =}'],['ItemId desc']);
@body=@tableItem.format(@format){
$if(@UserId){
@Goodsmprice();
}
$else{
@price=$var[Price];
}
@Price=$number.round(@price,2);
}
$return(@body);
}
//询价
$ajax indexinquer(){
$if($session[identify]<>$post(identify)){
$write(noIds);
$end();
}
@call=$call(public.xmls);
@call.load();
@queryi=$query(inquiry,inquiry);
@queryi.post();
$if($session[UserId]){
@queryi[UserId]=$session[UserId];
}
@queryi[AreaId]=$shell[AreaId];
@queryi.remove(InquiryId);
@id=@queryi.insert(1);
$if(@id>0){
@mail=$shell.getData(inquiryMail,/);
$if(@mail==1){
@rows=@queryi.row(@id);
@companyMail=$shell.getData(msgMail,/);
$if(@companyMail){
@mail=$call(~apps/mail/mail.xmls);
@maisl=@mail.send(@companyMail,inquiry,@rows);
}
}
$write(OK);
$end();
}
}
//产品MSDS
$sub GoodSdS(){
@queryg=$query(goods,goods);
@queryg[CAS]=$argv(0,$null);
@queryg[GoodsCode]=$argv(0,$null);
@gmap=@queryg.map(*,['{*GoodsCode =} {?} or {*CAS =}']);
$if(@gmap<>$null){
@queryd=$query(msds,download);
@queryd[GoodsCode]=@gmap[GoodsCode];
@queryd[Cas]=@gmap[CAS];
@FileName=@queryd.scalar(FileName,['GoodsCode={*GoodsCode} and Cas={*Cas} '],['MsdsId desc']);
$return(@FileName);
$end();
}
$return($empty);
}
//产品COA
$sub Goodcoa(){
@queryg=$query(goods,goods);
@queryg[CAS]=$argv(0,$null);
@queryg[GoodsCode]=$argv(0,$null);
@gmap=@queryg.map(*,['{*GoodsCode =} {?} or {*CAS =}']);
$if(@gmap<>$null){
@queryd=$query(coa,download);
@queryd[GoodsCode]=@gmap[GoodsCode];
@queryd[Cas]=@gmap[CAS];
@FileName=@queryd.scalar(FileName,['GoodsCode={*GoodsCode} and Cas={*Cas} '],['CoaId desc']);
$return(@FileName);
$end();
}
$return($empty);
}
//产品nmr
$sub Goodnmr(){
@queryg=$query(goods,goods);
@queryg[CAS]=$argv(0,$null);
@queryg[GoodsCode]=$argv(0,$null);
@gmap=@queryg.map(*,['{*GoodsCode =} {?} or {*CAS =}']);
$if(@gmap<>$null){
@queryd=$query(nmr,download);
@queryd[GoodsCode]=@gmap[GoodsCode];
@queryd[Cas]=@gmap[CAS];
@FileName=@queryd.scalar(FileName,['GoodsCode={*GoodsCode} and Cas={*Cas} '],['NMRandHPLCId desc']);
$return(@FileName);
$end();
}
$return($empty);
}
//收藏
$ajax Coller(Id){
@queryg=$query(goods,goods);
@queryg[CAS]=$argv(0,$null);
@queryg[GoodsCode]=$argv(0,$null);
@gmap=@queryg.map(*,['{*GoodsCode =} {?or (} {*CAS =}']);
$if(@gmap<>$null){
@queryc=$query(collect,user);
@queryc[UserId]=$session[UserId];
@queryc[GoodsId]=@Id;
@ind=@queryc.scalar(['count(*)'],['{*UserId =} and {*GoodsId =}']);
$if(@ind>0){
$write(isOK);
$end();
}
@queryc[GoodsName]=@gmap[EnGoodsName];
@queryc.insert();
$write(OK);
$end();
}
$return($empty);
}
//相关产品
$ajax GoodsTgs(){
@format=[#<li class="fl gsxWh">
<a class="block" href="{~../goods2/*GoodsId_*CatalogId}">
<span class="block"><img style="width:100px;" data-cas="{*CAS}" src="{@picc}" alt=""></span>
<div>
<p class="wot">{#left(GoodsName,20,...)}</p>
<p class="fomar wot">{*GoodsCode}</p>
</div>
</a>
</li>#];
@GuId=$post(Guid);
@querygoods=$query(goods,goods);
@querygoods[GuId]=@GuId;
@RelevantIds=@querygoods.scalar(Relation,['{*GuId =}']);
$if(@RelevantIds){
@querygoods.set(RelevantIds,@RelevantIds);
@Goodslist=@querygoods.table(['EnGoodsName,GoodsCode,GoodsName,CAS,GoodsCode,GoodsId,CatalogId'],['Status>0 and {*GoodsCode in @RelevantIds}'],['GoodsId desc'],5);
$if(@Goodslist.count()==0){
@GoodsListss=['<div style="color:#636262;font-size:12px;height:45px;line-height:45px;text-align:center;">对不起,暂无相关产品!</div>'];
}
$else{
@GoodsListss=@Goodslist.format(@format){
@pic=$var[GoodsCode];
$if(@pic<>$null){
@src=["/files/images/goods/{@pic}.png"];
$if($file.existsFile($file.getMapPath(@src))==1){
@picc=["{@src}"];
}
$else{
@picc=["/files/images/fande.png"];
}
}
};
}
}
$else{
@GoodsListss=['<div style="color:#636262;font-size:12px;height:45px;line-height:45px;text-align:center;">对不起,暂无相关产品!</div>'];
}
$write(@GoodsListss);
}
//推荐产品
$ajax GoodsTjs(){
@format=[#<li class="fl gsxWh">
<a class="block" href="{~../goods2/*GoodsId_*CatalogId}">
<span class="block"><img style="width:100px;" data-cas="{*CAS}" src="{@picc}" alt=""></span>
<div>
<p class="wot">{#left(GoodsName,20,...)}</p>
<p class="fomar wot">{*GoodsCode}</p>
</div>
</a>
</li>#];
@GuId=$post(Guid);
@querygoods=$query(goods,goods);
@querygoods[GuId]=@GuId;
@RelevantIds=@querygoods.scalar(Recommend,['{*GuId =}']);
$if(@RelevantIds){
@querygoods.set(RelevantIds,@RelevantIds);
@Goodslist=@querygoods.table(['EnGoodsName,GoodsCode,GoodsName,CAS,GoodsCode,GoodsId,CatalogId'],['Status>0 and {*GoodsCode in @RelevantIds}'],['GoodsId desc'],5);
$if(@Goodslist.count()==0){
@GoodsListss=['<div style="color:#636262;font-size:12px;height:45px;line-height:45px;text-align:center;">对不起,暂无相关产品!</div>'];
}
$else{
@GoodsListss=@Goodslist.format(@format){
@pic=$var[GoodsCode];
$if(@pic<>$null){
@src=["/files/images/goods/{@pic}.png"];
$if($file.existsFile($file.getMapPath(@src))==1){
@picc=["{@src}"];
}
$else{
@picc=["/files/images/fande.png"];
}
}
};
}
}
$else{
@GoodsListss=['<div style="color:#636262;font-size:12px;height:45px;line-height:45px;text-align:center;">对不起,暂无相关产品!</div>'];
}
$write(@GoodsListss);
}
//COA下载
$ajax documents(){
@format=[#<ul class="docume-tab">
<li>{*Title}</li>
<li>{*GoodsCode}</li>
<li>{*Cas}</li>
<li><a href="{*FileName}">Download</a></li>
</ul>#];
@table=$post(table);
@queryd=$query(@table,download);
$if(@table==coa){
@queryd[GoodsCode]=$post(Goods);
}
@queryd[LotNumber]=$post(Lot);
@dowmtable=@queryd.table(*,['{*LotNumber =} {?and} {*GoodsCode =}']);
@downlist=@dowmtable.format(@format);
$if(!@downlist){
@downlist=['<div style="color:#636262;font-size:12px;height:45px;line-height:45px;text-align:center;">没有文件上传,如果需要的话请与我们联系!</div>'];
}
$write(@downlist);
}
//产品评价
$sub commentList(counts,format){
@queryc=$query(comment,goods);
@queryGoods=$query(goods,goods);
@Guid=$argv(0,$null);
@queryGoods[CAS]=@Guid;
@GoodsId=@queryGoods.scalar(GoodsId,['{*CAS =}']);
@queryc[GoodsId]=@GoodsId;
@commlist=@queryc.table(*,['{*GoodsId =} and {*Status > 0}'],['CommentId desc']);
@tablecom=@commlist.format(@format){
@ind=$string($var[Username]).length();
@Username=$string($var[Username]).substring(2,@ind);
}
$if(@tablecom==$empty||@GoodsId==$empty){
@tablecom=['<tr><div style="color:red;font-size:12px;height:45px;line-height:45px;text-align:center;">对不起,暂无产品评价!</div></tr>'];
}
$return(@tablecom);
}
//产品点评
$ajax comment(Id){
$if(@Id<>$null){
@queryc=$query(comment,goods);
@queryc[UserId]=$session[UserId];
@queryc[GoodsId]=@Id;
@ind=@queryc.scalar(['count(*)'],['{*UserId =} and {*GoodsId =}']);
$if(@ind>0){
$write(isNo);
$end();
}
$else{
$write(OK);
$end();
}
}
$return($empty);
}
//查询产品SDS
$sub SelectSDS(){
@TableDownload=$query(msds,download);
@TableDownload[GoodsCode]=@GoodsCode;
@FileName=@TableDownload.scalar(FileName,['{*GoodsCode =} and AreaId=1']);
$if(@FileName){
@texten=$file.readText($file.getMapPath(@FileName));
$return(@texten);
}
$write($empty);
}
//查询产品en SDS
$sub SelectEnSDS(){
@TableDownload=$query(msds,download);
@TableDownload[GoodsCode]=@GoodsCode;
@FileName=@TableDownload.scalar(FileName,['{*GoodsCode =} and AreaId=2']);
$if(@FileName){
@texten=$file.readText($file.getMapPath(@FileName));
$return(@texten);
}
$write($empty);
}
//最新产品
$ajax GoodsZxs(){
@format=[#<li class="fl">
<a class="block" href="{~../goods/*CAS}">
<span class="block"><img class="maxwh" data-cas="{*CAS}" src="{@picc}" alt=""></span>
<div >
<p class="wot">{#left(GoodsName,20,...)}</p>
<p class="fomar wot">{*GoodsCode}</p>
</div>
</a>
</li>#];
@GuId=$post(Guid);
@querygoods=$query(goods,goods);
@querycatalog=$query(catalog,goods);
@tagId=[",3,"];
@Goodslist=@querygoods.table(['EnGoodsName,GoodsName,CAS,GoodsCode,Guid'],['Status>0 and {*TagIds like @tagId}'],['GoodsId desc'],5);
@GoodsLists=@Goodslist.format(@format){
@pic=$var[GoodsCode];
$if(@pic<>$null){
@src=["/files/images/goods/{@pic}.png"];
$if($file.existsFile($file.getMapPath(@src))==1){
@picc=["{@src}"];
}
$else{
@picc=["/files/images/fande.png"];
}
}
}
$if(!@GoodsLists){
@count=0;
@GoodsLists=['<div style="color:#636262;font-size:12px;height:45px;line-height:45px;text-align:center;">对不起,暂无相关产品!</div>'];
}
$write(@GoodsLists);
}
//新闻
$sub glistNews(format,tagIds){
@row=$map();
@call=$call(xmls/public.xmls);
@call.load();
@querynew=$query(content,content);
@tagId=[",{@tagIds},"];
@querynew[TagIds]=@tagId;
@listnews=@querynew.table( *,['Status>0 and {*AreaId = $shell[AreaId]} and {*TagIds like }'],['Grade desc,Modified desc,ContentId desc'],10);
@contentlist=@listnews.format(@format);
$if(@contentlist==$empty){
@contentlist=['<div style="color:#FF0000;font-size:12px;height:45px;line-height:45px;text-align:center;">抱歉,暂无数据!</div>'];
}
$return(@contentlist);
}