深圳全飞鸿

标题: 箱号规则特殊案例 [打印本页]

作者: zhgc    时间: 2022-1-14 11:09
标题: 箱号规则特殊案例
箱号规则特殊案例

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;






欢迎光临 深圳全飞鸿 (http://www.nagomes.com/disc/) Powered by Discuz! X3.2