头表


With userInfo As
 (Select * From Usermst)
Select MTIN.STATUS As Instatus,
       MTOUT.STATUS As Outstatus,
       C.MOVETASKGROUPID As Repunitid,
       MTIN.TASKID As Instockpickid,
       MTOUT.TASKID As Outstockpickid,
       MTIN.GOODSID,
       D.NAME As Goodsname,
       D.MODEL,
       D.Trademark,
       MTIN.GOODSBATCH,
       DECODE(MTOUT.Factbigunitnum,
              0,
              MTIN.Factbigunitnum,
              MTOUT.Factbigunitnum) As Actbigunitnum,
       MTIN.Qualityflg,
       MTOUT.STOCKAREAID As Orgstockareaid,
       MTOUT.GOODSAREAID As Orggoodsareaid,
       MTOUT.GOODSPOSID As Orggoodsposid,
       MTIN.STOCKAREAID As Dststockareaid,
       MTIN.GOODSAREAID As Dstgoodsareaid,
       MTIN.GOODSPOSID As Dstgoodsposid,
       MTOUT.STOCKID As Dststockid,
       MTIN.CREATEDATE As Createtime,
       MTIN.UPDATEDATE As Releasetime,
       MTOUT.OPERATEDATE As PICKAWAYTIME,
       MTOUT.UPDATEDATE_OUT As Pickendtime,
       MTIN.OPERATEDATE As PUTAWAYTIME,
       MTIN.UPDATEDATE_IN As Putendtime,
       E.PRODUCTDATE,
       E.EXPIREDATE,
       MTOUT.Bigunitnum,
       MTOUT.Midunitnum,
       MTOUT.Standunitnum,
       G.Shortname As Pickman,
       F.Shortname As Putman,
       MTIN.Containerid,
       MTIN.Memo,
       MTIN.Movetype,
       MTIN.Moveid,
       MTIN.COMPANYID,
       MTIN.OWNERID,
       MTIN.STOCKID,
       WCSA.PRIORITY AS TASKPRIORITY,
       WCSB.PRIORITY AS PRIORITY
  From (Select A.STATUS,
               A.CREATEDATE,
               A.UPDATEDATE As UPDATEDATE_IN,
               A.Movetype,
               B.*
          From Movestocktbl A, Movestockdttbl B
         Where A.TASKID = B.TASKID
           And A.INOUTTYPE = '1') MTIN,
       (Select A.STATUS,
               A.CREATEDATE,
               A.UPDATEDATE As UPDATEDATE_OUT,
               A.Movetype,
               B.*
          From Movestocktbl A, Movestockdttbl B
         Where A.TASKID = B.TASKID
           And A.INOUTTYPE = '2') MTOUT,
       Movetaskgroup C,
       GOODSMST D,
       GOODSBATCHMST E,
       userInfo F,
       userInfo G,
       (SELECT A.TASKID, MAX(A.PRIORITY) AS PRIORITY
          FROM WCS_STOCKOUT_TASK A
         GROUP BY A.TASKID) WCSA,
       (SELECT A.TASKID, MAX(A.PRIORITY) AS PRIORITY
          FROM WCS_TASK_PRIORITY A
         GROUP BY A.TASKID) WCSB
 Where MTIN.TASKID = MTOUT.CONTRACTMOVETASKID
   And MTIN.TASKID = C.TASKID(+)
   And MTIN.GOODSID = D.GOODSID
   And MTIN.GOODSID = E.GOODSID
   And MTIN.GOODSBATCH = E.GOODSBATCH
   And MTIN.Operator = F.USERID(+)
   And MTOUT.Operator = G.USERID(+)
   And MTOUT.TASKID = WCSA.TASKID(+)
   And MTOUT.TASKID = WCSB.TASKID(+)
   And MTIN.GOODSID = '1000079607'
   And MTIN.STATUS = '2'
   And MTOUT.STATUS = '2'
   AND MTIN.MOVETYPE = '5'
   AND MTIN.CREATEDATE >= '2024-05-02 00:00:00'
   AND MTIN.CREATEDATE <= '2024-05-09 23:59:59'
   AND MTIN.STOCKID = '80'
   AND MTIN.OWNERID = 'CQP'
 Order By MTIN.CREATEDATE Desc
文档更新时间: 2024-05-09 20:35   作者:周骏