Exemplo n.º 1
0
        /// <summary>
        /// 更新到SAP,并返回是否全部更新成功
        /// </summary>
        /// <param name="sWorkflowNo"></param>
        /// <returns></returns>
        public bool UpdateToSAP(string sWorkflowNo,ref List<string> lisSucPO)
        {
            StringBuilder sbError = new StringBuilder();
            StringBuilder sbSuccess = new StringBuilder();
            bool isAllSuccess = true;

            DataTable dtResult = new DataTable();
            DataTable dtPars = new DataTable();
            Common comm = new Common();

            dtPars = GetUpdatePars();
            dtResult = comm.UpdateOSPPrice(dtPars);// xu???
            foreach (DataRow dr in dtResult.Rows)
            {
                string sPONO = dr["PONO"] == null ? string.Empty : dr["PONO"].ToString();
                string sStatus = dr["Status"] == null ? string.Empty : dr["Status"].ToString();
                if (sStatus == "1")//是更新成功的
                {
                    UpdateItemStaus(sWorkflowNo, sPONO, true);
                    lisSucPO.Add(sPONO);
                    sbSuccess.Append(string.Format("PO No. {0} update successed \\n", sPONO));
                }
                else//更新失败。
                {
                    string sError = dr["ErrorInfo"] == null ? string.Empty : dr["ErrorInfo"].ToString();
                    sbError.Append(string.Format("Style No. {0} update failed,error info:{1} \\n", sPONO, sError));
                    isAllSuccess = false;
                    UpdateItemStaus(sWorkflowNo, sPONO, false);
                }
            }
            string sPADUpdateError= UpdatePAD(sWorkflowNo, dtPars);
            if (sPADUpdateError.Length > 0)
            {
                isAllSuccess = false;
                CommonUtil.logError("PoTypeChangeWorkflow update PAD to sap error:" + sPADUpdateError);
            }
            if (sbError.Length > 0)
            {
                CommonUtil.logError("PoTypeChangeWorkflow update to sap error:" + sbError.ToString());
            }

            return isAllSuccess;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 更新到SAP
        /// </summary>
        /// <returns></returns>
        public bool UpdateToSAP()
        {
            StringBuilder sbError = new StringBuilder();
            StringBuilder sbSuccess = new StringBuilder();
            bool isAllSuccess = true;

            DataTable dtResult = new DataTable();
            DataTable dtPars = new DataTable();
            Common comm = new Common();

            dtPars = GetUpdatePars();
            dtResult= comm.UpdateOSPPrice(dtPars);
            foreach (DataRow dr in dtResult.Rows)
            {
                string sPONO = dr["PONO"] == null ? string.Empty : dr["PONO"].ToString();
                string sStatus=dr["Status"]==null?string.Empty:dr["Status"].ToString();
                if (sStatus == "1")//是更新成功的
                {
                    UpdateItemStaus(sPONO, true);
                    sbSuccess.Append(string.Format("PO No. {0} update successed \\n", sPONO));
                }
                else//更新失败。
                {
                    string sError = dr["ErrorInfo"] == null ? string.Empty : dr["ErrorInfo"].ToString();
                    sbError.Append(string.Format("PO No. {0} update failed,error info:{1} \\n", sPONO, sError));
                    isAllSuccess = false;
                    UpdateItemStaus(sPONO, false);
                }
            }

            string sPADUpdateError = UpdatePAD(dtPars);
            if (sPADUpdateError.Length > 0)
            {
                isAllSuccess = false;
            }
            Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", string.Format("<script>alert('{0}\\n{1}\\n\\n{2}')</script>", sbError.ToString(), sPADUpdateError, sbSuccess.ToString()));
            return isAllSuccess;
        }