深圳全飞鸿

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 443|回复: 0
打印 上一主题 下一主题

箱号规则特殊案例

[复制链接]

800

主题

1379

帖子

7704

积分

版主

Rank: 7Rank: 7Rank: 7

积分
7704
跳转到指定楼层
楼主
发表于 2022-1-14 11:09:23 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
箱号规则特殊案例

BD666白色
[length=16][CT81501I](YMD-BAIDU){00000:0123456789}

(YMD-BAIDU)

  SET l_ctn_code =a;
  -- fix by syant

  if(l_ctn_code like '%(WWYY)%')then
    select concat(lpad(weekofyear(curdate()),2,'0'),date_format(now(),'%y') ) into replace_str  from dual;
     set l_ctn_code:= replace(l_ctn_code, '(WWYY)',concat('[', replace_str,']'));
                set @h:=l_ctn_code;
  end if;

IF(l_ctn_code LIKE '%(YYYYWW)%')THEN
    SELECT CONCAT(DATE_FORMAT(NOW(),'%Y'),LPAD(WEEKOFYEAR(CURDATE()),2,'0') ) INTO replace_str  FROM DUAL;
     SET l_ctn_code:= REPLACE(l_ctn_code, '(YYYYWW)',CONCAT('[', replace_str,']'));
                SET @h:=l_ctn_code;
  END IF;  

-- 转换周数 by WIKI 2020/07/01
  if(l_ctn_code like '%(YWW)%')then
    select concat(right(date_format(now(),'%y'),1),lpad(weekofyear(curdate()),2,'0') ) into replace_str  from dual;
     set l_ctn_code:= replace(l_ctn_code, '(YWW)',concat('[', replace_str,']'));
                set @h:=l_ctn_code;
  end if;

-- 转换周数 by WIKI 2020/08/17
  IF(l_ctn_code LIKE '%(YYWW)%')THEN
    SELECT CONCAT(RIGHT(DATE_FORMAT(NOW(),'%y'),2),LPAD(WEEKOFYEAR(CURDATE()),2,'0') ) INTO replace_str  FROM DUAL;
     SET l_ctn_code:= REPLACE(l_ctn_code, '(YYWW)',CONCAT('[', replace_str,']'));
                SET @h:=l_ctn_code;
  END IF;


-- 转化百度规定的YMD by syant 2021/06/28
  IF(l_ctn_code LIKE '%(YMD-BAIDU)%')THEN
                set yy= sfc.int_to_str(date_format(l_worktime,'%y')*1-18,'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
                set mm= sfc.int_to_str(date_format(l_worktime,'%m')*1,'0123456789ABC');
                set dd= sfc.int_to_str(date_format(l_worktime,'%d')*1,'0123456789ABCDEFGHJKLMNPQRSTUVWX');
     SET l_ctn_code:= REPLACE(l_ctn_code, '(YMD-BAIDU)',CONCAT('[', yy,mm,dd,']'));
                SET @h:=l_ctn_code;
  END IF;

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|nagomes  

GMT+8, 2025-5-5 00:28 , Processed in 0.027034 second(s), 21 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表