--生产工单任务状态不等于未开工时：开工记账日期=开工时间
update t_pom_mftorderentry a  set fbeginbookdate = (select top 1 case when e.fstartworktime is not null then e.fstartworktime else e.ftransmittime end from t_pom_mftorderentry_e e where e.fentryid = a.fentryid and ftaskstatus <> 'A' and fbeginbookdate is null) 
where exists (select top 1 case when e.fstartworktime is not null then e.fstartworktime else e.ftransmittime end from t_pom_mftorderentry_e e where e.fentryid = a.fentryid and ftaskstatus <> 'A' and fbeginbookdate is null);
--生产工单业务状态=关闭：关闭记账日期=关闭时间
update t_pom_mftorderentry a  set fclosebookdate = (select  top 1 e.fclosetime from t_pom_mftorderentry_e e where e.fentryid = a.fentryid and fbizstatus = 'C' and fclosebookdate is null) 
where exists (select  top 1 e.fclosetime from t_pom_mftorderentry_e e where e.fentryid = a.fentryid and fbizstatus = 'C' and fclosebookdate is null);
--变更日志：开工记账日期=单据日期
update t_pom_xmftordermlog set fbeginbookdate = fbiztime where fbeginbookdate is null;
--拆分日志：开工记账日期=拆分时间的年月日 
update t_pom_splitentry a set fbeginbookdate = (select  top 1 e.fcreatetime from t_pom_splitlog e where e.fid = a.fid and fbeginbookdate is null)
where exists (select  top 1 e.fcreatetime from t_pom_splitlog e where e.fid = a.fid and fbeginbookdate is null);