Ejemplo n.º 1
0
        public override void AfterDo(object bp, ref object result)
        {
            if (result != null
                )
            {
                //HBHTransferSV transSV = bp as HBHTransferSV;

                //if (transSV != null)
                //{
                //    svID = transSV.ID;
                //}

                List <TransferInResultDTO> resultTransfer = result as List <TransferInResultDTO>;
                List <ShipBackDTO>         resultShipBack = result as List <ShipBackDTO>;
                List <SoBackDTO>           resultSOBack   = result as List <SoBackDTO>;

                if (resultTransfer != null)
                {
                    TransferInResultDTO first = resultTransfer.GetFirst();

                    if (first != null)
                    {
                        HBHCommon.HBHCommonSVAfter(svID, resultTransfer, first.IsSuccess, first.ErrorInfo, first.ERPDocNo);
                    }
                }
                else if (resultShipBack != null)
                {
                    if (resultShipBack != null)
                    {
                        ShipBackDTO first = resultShipBack.GetFirst();

                        if (first != null)
                        {
                            HBHCommon.HBHCommonSVAfter(svID, result, first.IsSuccess, first.ErrorInfo, first.ERPDocNo);
                        }
                    }
                }
                else if (resultSOBack != null)
                {
                    if (resultSOBack != null)
                    {
                        SoBackDTO first = resultSOBack.GetFirst();

                        if (first != null)
                        {
                            HBHCommon.HBHCommonSVAfter(svID, result, first.IsSuccess, first.ErrorInfo, first.ERPDocNo);
                        }
                    }
                }
                else
                {
                    HBHCommon.HBHCommonSVAfter(svID, result, true, string.Empty, string.Empty);
                }
            }
        }
        private List<TransferInResultDTO> CreateTransferIn(CreateApprovedTransferInSV bpObj)
        {
            System.Collections.Generic.List<TransferInResultDTO> result = new System.Collections.Generic.List<TransferInResultDTO>();
            //object result2;
            try
            {
                if (bpObj.TransferInLineDTOList == null || bpObj.TransferInLineDTOList.Count == 0)
                {
                    //result.Add(new TransferInResultDTO
                    //{
                    //    IsSuccess = false,
                    //    ErrorInfo = "传入参数不可为空",
                    //    Timestamp = System.DateTime.Now
                    //});
                    //result2 = result;

                    TransferInResultDTO backDTO = new TransferInResultDTO();
                    backDTO.IsSuccess = false;
                    backDTO.ErrorInfo = "传入参数不可为空";
                    backDTO.Timestamp = System.DateTime.Now;
                    HBHCommon.LoggerError(backDTO.ErrorInfo);
                    result.Add(backDTO);
                }
                else
                {
                    string errormessage = this.ValidateParamNullOrEmpty(bpObj);
                    if (!string.IsNullOrEmpty(errormessage))
                    {
                        //result.Add(new TransferInResultDTO
                        //{
                        //    IsSuccess = false,
                        //    ErrorInfo = errormessage + "请检查传入参数",
                        //    Timestamp = System.DateTime.Now
                        //});
                        //result2 = result;

                        TransferInResultDTO backDTO = new TransferInResultDTO();
                        backDTO.IsSuccess = false;
                        backDTO.ErrorInfo = errormessage + "请检查传入参数";
                        backDTO.Timestamp = System.DateTime.Now;
                        HBHCommon.LoggerError(backDTO.ErrorInfo);
                    }
                    else
                    {
                        System.Collections.Generic.List<CommonArchiveDataDTOData> transinidlist;
                        //using (UBFTransactionScope trans = new UBFTransactionScope(TransactionOption.Required))
                        {
                            try
                            {
                                UFIDA.U9.ISV.TransferInISV.Proxy.CommonCreateTransferInSVProxy proxy = new UFIDA.U9.ISV.TransferInISV.Proxy.CommonCreateTransferInSVProxy();
                                proxy.TransferInDTOList = (this.GetTransferInDTOList(bpObj));
                                transinidlist = proxy.Do();
                                if (transinidlist == null || transinidlist.Count <= 0)
                                {
                                    //result.Add(new TransferInResultDTO
                                    //{
                                    //    IsSuccess = false,
                                    //    ErrorInfo = "生单失败:没有生成调入单",
                                    //    Timestamp = System.DateTime.Now
                                    //});
                                    //result2 = result;
                                    //return result2;

                                    TransferInResultDTO backDTO = new TransferInResultDTO();
                                    backDTO.IsSuccess = false;
                                    backDTO.ErrorInfo = "生单失败:没有生成调入单";
                                    backDTO.Timestamp = System.DateTime.Now;
                                    HBHCommon.LoggerError(backDTO.ErrorInfo );
                                    return result;
                                }
                                TransferInBatchApproveSRVProxy approveproxy = new TransferInBatchApproveSRVProxy();
                                approveproxy.DocList = (transinidlist);
                                approveproxy.ApprovedBy = (Context.LoginUser);
                                approveproxy.ApprovedOn = (System.DateTime.Now);
                                approveproxy.Do();
                                //trans.Commit();
                            }
                            catch (System.Exception e)
                            {
                                //trans.Rollback();
                                //result.Add(new TransferInResultDTO
                                //{
                                //    IsSuccess = false,
                                //    ErrorInfo = "生单失败:" + e.Message,
                                //    Timestamp = System.DateTime.Now
                                //});
                                //result2 = result;
                                //return result2;

                                TransferInResultDTO backDTO = new TransferInResultDTO();
                                backDTO.IsSuccess = false;
                                backDTO.ErrorInfo = "生单失败:" + e.Message;
                                backDTO.Timestamp = System.DateTime.Now;
                                HBHCommon.LoggerError(backDTO.ErrorInfo + "/r/n" + e.StackTrace);
                                return result;
                            }
                        }
                        foreach (CommonArchiveDataDTOData transin in transinidlist)
                        {
                            TransferIn t = TransferIn.Finder.FindByID(transin.ID);
                            if (t != null)
                            {
                                result.Add(new TransferInResultDTO
                                {
                                    IsSuccess = true,
                                    ErrorInfo = "生单成功",
                                    Timestamp = System.DateTime.Now,
                                    ERPDocNo = transin.Code,
                                    TransDocNo = t.DescFlexField.PrivateDescSeg4
                                });
                            }
                        }
                        //result2 = result;
                    }
                }
            }
            catch (System.Exception e)
            {
                //result.Add(new TransferInResultDTO
                //{
                //    IsSuccess = false,
                //    ErrorInfo = e.Message,
                //    Timestamp = System.DateTime.Now
                //});
                //result2 = result;

                TransferInResultDTO backDTO = new TransferInResultDTO();
                backDTO.IsSuccess = false;
                backDTO.ErrorInfo = e.Message;
                backDTO.Timestamp = System.DateTime.Now;
                HBHCommon.LoggerError(backDTO.ErrorInfo + "/r/n" + e.StackTrace);
            }
            //return result2;
            return result;
        }
Ejemplo n.º 3
0
        private List <TransferInResultDTO> CreateTransferIn(CreateApprovedTransferInSV bpObj)
        {
            System.Collections.Generic.List <TransferInResultDTO> result = new System.Collections.Generic.List <TransferInResultDTO>();
            //object result2;
            try
            {
                if (bpObj.TransferInLineDTOList == null || bpObj.TransferInLineDTOList.Count == 0)
                {
                    //result.Add(new TransferInResultDTO
                    //{
                    //    IsSuccess = false,
                    //    ErrorInfo = "传入参数不可为空",
                    //    Timestamp = System.DateTime.Now
                    //});
                    //result2 = result;

                    TransferInResultDTO backDTO = new TransferInResultDTO();
                    backDTO.IsSuccess = false;
                    backDTO.ErrorInfo = "传入参数不可为空";
                    backDTO.Timestamp = System.DateTime.Now;
                    HBHCommon.LoggerError(backDTO.ErrorInfo);
                    result.Add(backDTO);
                }
                else
                {
                    string errormessage = this.ValidateParamNullOrEmpty(bpObj);
                    if (!string.IsNullOrEmpty(errormessage))
                    {
                        //result.Add(new TransferInResultDTO
                        //{
                        //    IsSuccess = false,
                        //    ErrorInfo = errormessage + "请检查传入参数",
                        //    Timestamp = System.DateTime.Now
                        //});
                        //result2 = result;

                        TransferInResultDTO backDTO = new TransferInResultDTO();
                        backDTO.IsSuccess = false;
                        backDTO.ErrorInfo = errormessage + "请检查传入参数";
                        backDTO.Timestamp = System.DateTime.Now;
                        HBHCommon.LoggerError(backDTO.ErrorInfo);
                    }
                    else
                    {
                        System.Collections.Generic.List <CommonArchiveDataDTOData> transinidlist;
                        //using (UBFTransactionScope trans = new UBFTransactionScope(TransactionOption.Required))
                        {
                            try
                            {
                                UFIDA.U9.ISV.TransferInISV.Proxy.CommonCreateTransferInSVProxy proxy = new UFIDA.U9.ISV.TransferInISV.Proxy.CommonCreateTransferInSVProxy();
                                proxy.TransferInDTOList = (this.GetTransferInDTOList(bpObj));
                                transinidlist           = proxy.Do();
                                if (transinidlist == null || transinidlist.Count <= 0)
                                {
                                    //result.Add(new TransferInResultDTO
                                    //{
                                    //    IsSuccess = false,
                                    //    ErrorInfo = "生单失败:没有生成调入单",
                                    //    Timestamp = System.DateTime.Now
                                    //});
                                    //result2 = result;
                                    //return result2;

                                    TransferInResultDTO backDTO = new TransferInResultDTO();
                                    backDTO.IsSuccess = false;
                                    backDTO.ErrorInfo = "生单失败:没有生成调入单";
                                    backDTO.Timestamp = System.DateTime.Now;
                                    HBHCommon.LoggerError(backDTO.ErrorInfo);
                                    return(result);
                                }
                                TransferInBatchApproveSRVProxy approveproxy = new TransferInBatchApproveSRVProxy();
                                approveproxy.DocList    = (transinidlist);
                                approveproxy.ApprovedBy = (Context.LoginUser);
                                approveproxy.ApprovedOn = (System.DateTime.Now);
                                approveproxy.Do();
                                //trans.Commit();
                            }
                            catch (System.Exception e)
                            {
                                //trans.Rollback();
                                //result.Add(new TransferInResultDTO
                                //{
                                //    IsSuccess = false,
                                //    ErrorInfo = "生单失败:" + e.Message,
                                //    Timestamp = System.DateTime.Now
                                //});
                                //result2 = result;
                                //return result2;

                                TransferInResultDTO backDTO = new TransferInResultDTO();
                                backDTO.IsSuccess = false;
                                backDTO.ErrorInfo = "生单失败:" + e.Message;
                                backDTO.Timestamp = System.DateTime.Now;
                                HBHCommon.LoggerError(backDTO.ErrorInfo + "/r/n" + e.StackTrace);
                                return(result);
                            }
                        }
                        foreach (CommonArchiveDataDTOData transin in transinidlist)
                        {
                            TransferIn t = TransferIn.Finder.FindByID(transin.ID);
                            if (t != null)
                            {
                                result.Add(new TransferInResultDTO
                                {
                                    IsSuccess  = true,
                                    ErrorInfo  = "生单成功",
                                    Timestamp  = System.DateTime.Now,
                                    ERPDocNo   = transin.Code,
                                    TransDocNo = t.DescFlexField.PrivateDescSeg4
                                });
                            }
                        }
                        //result2 = result;
                    }
                }
            }
            catch (System.Exception e)
            {
                //result.Add(new TransferInResultDTO
                //{
                //    IsSuccess = false,
                //    ErrorInfo = e.Message,
                //    Timestamp = System.DateTime.Now
                //});
                //result2 = result;

                TransferInResultDTO backDTO = new TransferInResultDTO();
                backDTO.IsSuccess = false;
                backDTO.ErrorInfo = e.Message;
                backDTO.Timestamp = System.DateTime.Now;
                HBHCommon.LoggerError(backDTO.ErrorInfo + "/r/n" + e.StackTrace);
            }
            //return result2;
            return(result);
        }