SELECT
MoCode AS 生产订单号码 ,
MoTypeDesc AS 订单类型,
UA_User.cUser_Name AS 制单人,
MakeDate AS 制单日期,
(CASE Status
WHEN 1 THEN '未审核'
WHEN 2 THEN '锁定'
WHEN 3 THEN '审核'
WHEN 4 THEN '关闭' END) AS 生产订单状态,
MoSeq AS 行号 ,
StartDate AS 开工日期 ,
DueDate AS 完工日期 ,
DeptName AS 生产部门,
InvCode AS 存货编码 ,
InvName AS 存货名称 ,
InvStd AS 存货规格 ,
UnitCode AS 主计量单位 ,
Qty AS 数量,
QualifiedInQty AS 入库数量
FROM v_mom_orderdetail
JOIN UA_User ON v_mom_orderdetail.Maker=UA_User.cUser_Id
WHERE QualifiedInQty<>Qty AND Status=3