none
EF视图--表/视图 未定义主键,并且无法推断有效的主键。 RRS feed

  • 问题

  • create or replace view mcerp_v_waitstockin as
    
    select nvl(flngsaleorderid,1) flngsaleorderid,fchrsaleorderno,fdtmdate,flngaudit,
    flngcustomerid, fchrcustomername, fchrphone,
    flngpositionid, fchrpositioncode,fchrpositionname, fchrpositionfullname,
    flngdepartmentid, fchrdepartmentfullname,
    flngemployeeid,fchremployeecode, fchremployeename,
    flotquantity,fchrnote,flngreceipttypeid,fchrreceipttype
    from
    (
    select mp.flngpurchaseorderid flngsaleorderid,mp.fchrpurchaseorderno fchrsaleorderno,mp.fdtmdate,mp.flngaudit,-----待入库数据
    mp.flngsupplyid flngcustomerid, c.strcustomername fchrcustomername,mp.fchrphone,
    mp.flngpositionid,p.strpositioncode fchrpositioncode, p.strpositionname fchrpositionname,p.strfullname fchrpositionfullname,
    mp.flngdepartmentid, d.strfullname fchrdepartmentfullname,
    mp.flngemployeeid, e.stremployeecode fchremployeecode, e.stremployeename fchremployeename,
    mp.flotquantity,mp.fchrnote,mp.flngreceipttypeid,case when flngreceipttypeid=1 then '采购入库' when flngreceipttypeid=2 then '采购退货' end fchrreceipttype
    from mcerp_purchaseorder mp
    inner  join department d on mp.flngdepartmentid = d.lngdepartmentid
    inner join employee e on mp.flngemployeeid = e.lngemployeeid
    inner join position p on mp.flngpositionid=p.lngpositionid
    left join supplypreapp s on mp.flngsupplyid=s.lngsupplypreappid
    left join customerex c on mp.flngsupplyid = c.lngcustomerid
    where  mp.flngaudit=1 and (mp.flngstock=0 or mp.flngstock=1)and mp.fbitclose=0
    union all-------------调拨入库
    select  a.flngallocateid flngsaleorderid,a.fchrallocateno fchrsaleorderno,a.fdtmdate,a.flngaudit,----申请单ID,申请单号,单据日期,审核状态,
    0 flngcustomerid, '' fchrcustomername,'' fchrphone,------客户id,客户名,客户电话
    a.flnginpositionid flngpositionid,pp.strpositioncode fchrpositioncode,pp.strpositionname fchrpositionname,pp.strfullname fchrpositionfullname,----仓库
    0 flngdepartmentid, '' fchrdepartmentfullname,-----部门
    a.flngemployeeid,e.stremployeecode fchremployeecode,e.stremployeename fchremployeename,-----业务员
    a.flotquantity,a.fchrnote,21 flngreceipttypeid,'调拨单' fchrreceipttype ----数量,备注,单据类型ID,单据类型str
    from mcerp_allocate a
    inner join position pp on pp.lngpositionid=a.flnginpositionid
    left join employee e on e.lngemployeeid=a.flngemployeeid
    where a.flnginid<=0 and a.flngoutid>0
    union all------其他入库,其他入库退
    select a.flngotherinoutid flngsaleorderid,a. fchrotherinoutno,a.fdtmdate,a.flngaudit,
    a.flngcustomerid, c.strcustomername fchrcustomername,c.strmovephone fchrphone,
    a.flngpositionid,pp.strpositioncode fchrpositioncode,pp.strpositionname fchrpositionname,pp.strfullname fchrpositionfullname,
    a.flngdepartmentid, d.strfullname fchrdepartmentfullname,
    a.flngemployeeid,e.stremployeecode fchremployeecode,e.stremployeename fchremployeename,
    a.flotquantity,a.fchrnote,flngreceipttypeid,case when flngreceipttypeid=31 then '其他入库申请' when flngreceipttypeid=32 then '其他入库退回' end fchrreceipttype
    from mcerp_otherinout a
    inner  join department d on a.flngdepartmentid = d.lngdepartmentid
    inner join position pp on pp.lngpositionid=a.flngpositionid
    left join employee e on e.lngemployeeid=a.flngemployeeid
    left join customerex c on a.flngcustomerid = c.lngcustomerid
    where a.flngstock<>2 and a.flngauditid>0 and (a.flngreceipttypeid=31 or a.flngreceipttypeid=32)

    上面ORACLE视图。

    在添加到InvoicingEntity.edmx中时,如下图

    点击完成后,.edmx文件中没有该视图

    请版主或各位大神帮忙看一下。谢谢这是ORACLE数据,视图SQL是将3个表union all成1个。

    不胜感激。

    2012年6月20日 10:01

答案

全部回复