Exemple #1
0
        /// <summary>
        /// 在检验单的保存或审核时,会把酶活相关数据反写到收料单,导致收料单上的酶活量跟批次号主档资料里面的跟踪信息对不上,这里重新保存一下收料单以便刷新批号主档资料
        /// </summary>
        /// <param name="e"></param>
        public override void AfterExecuteOperationTransaction(AfterExecuteOperationTransaction e)
        {
            base.AfterExecuteOperationTransaction(e);

            if (e.DataEntitys.IsEmpty())
            {
                return;
            }

            string sql = @"/*dialect*/   
                        update t set t.FSECQTY =x.FACTRECEIVEQTY * x.FJNUnitEnzymes 
	                    from  T_QM_INSPECTBILL a   
	                    inner join T_QM_INSPECTBILLENTRY b on a.fid=b.fid
	                    inner join  T_QM_INSPECTBILLENTRY_LK c on b.FENTRYID =c.FENTRYID  and c.FRULEID ='QM_PURReceive2Inspect'  
	                    inner join  T_PUR_ReceiveEntry x on x.FENTRYID =c.fsid and x.fid =c.FSBILLID 
	                    inner join  T_PUR_Receive y on x.FID =y.fid  
	                    inner join T_BD_LOTMASTERBILLTRACE t on FBILLFORMID ='PUR_ReceiveBill'  and t.fbillid=x.FID and t.FBILLENTRYID =x.FENTRYID  
	                    inner join T_BD_LOTMASTER tt on t.FLOTID =tt.FLOTID 
	                    where  a.fid ={0} ;"    ;

            List <string> sqlLst           = new List <string>();
            FormMetadata  billTypeFormMeta = FormMetaDataCache.GetCachedFormMetaData(this.Context, "PUR_ReceiveBill");
            var           dyType           = billTypeFormMeta.BusinessInfo.GetDynamicObjectType();

            foreach (var item in e.DataEntitys)
            {
                sqlLst.Add(string.Format(sql, item["Id"]));
            }
            if (sqlLst.Count > 0)
            {
                DBUtils.ExecuteBatch(this.Context, sqlLst, 50);
            }

            CacheUtil.ClearCache(this.Context.DBId, "PUR_ReceiveBill");
            CacheUtil.ClearCache(this.Context.DBId, "BD_BatchMainFile");
        }