Example #1
0
        /// <summary>
        /// Get step «×éÍÅèÒÊØ´¢Í§ serial ¹Õé
        /// </summary>
        /// <param name="inSQLHelper"></param>
        /// <param name="inPdSer"></param>
        /// <param name="inForRecalChkDelRefPdX3"></param>
        /// <returns></returns>
        public static string GetPdSerPStep(WS.Data.Agents.cDBMSAgent inSQLHelper, System.Data.IDbConnection inDbConn, System.Data.IDbTransaction inDbTran, string inPdSer, bool inForRecalChkDelRefPdX3)
        {
            string strErrorMsg = "";

            string xdRefPInv    = DocumentType.BI.ToString() + "," + DocumentType.BQ.ToString() + "," + DocumentType.BR.ToString() + "," + DocumentType.BU.ToString() + "," + DocumentType.BV + "," + DocumentType.BY.ToString() + ",";
            string xdRefPDrNote = DocumentType.BD.ToString() + "," + DocumentType.BX.ToString() + "," + DocumentType.BB.ToString() + "," + DocumentType.BZ.ToString() + ",";
            string xdRefPCrNote = DocumentType.BC.ToString() + "," + DocumentType.BA.ToString() + "," + DocumentType.BM.ToString() + "," + DocumentType.BN.ToString() + ",";

            string  strRetPStep = BusinessEnum.gc_PDSER_PSTEP_FREE;
            DataSet dtsTem      = new DataSet();

            //inSQLHelper.SetPara(new object[] {inPdSer});
            //if (inSQLHelper.SQLExec(ref dtsTem, "QRefPdX3", MapTable.Table.RefPdX3, "select * from "+MapTable.Table.RefPdX3+" where fcPdSer = ? " , ref strErrorMsg))
            if (inSQLHelper.BatchSQLExec(ref dtsTem, "QRefPdX3", MapTable.Table.RefPdX3, "select * from " + MapTable.Table.RefPdX3 + " where fcPdSer = ? ", new object[] { inPdSer }, ref strErrorMsg, inDbConn, inDbTran))
            {
                foreach (DataRow dtrRefPdX3 in dtsTem.Tables["QRefPdX3"].Rows)
                {
                    if (inForRecalChkDelRefPdX3)
                    {
                    }
                    else
                    {
                        int    intCmp     = -1;
                        string strRefType = dtrRefPdX3["fcRefType"].ToString();
                        if (DocumentType.PO.ToString().IndexOf(strRefType) > -1)
                        {
                            //strRetPStep = max( strRetPStep , gc_PDSER_PSTEP_ORDER );
                            //strRetPStep = BusinessEnum.gc_PDSER_PSTEP_ORDER;
                            intCmp      = BusinessEnum.gc_PDSER_PSTEP_ORDER.CompareTo(strRetPStep);
                            strRetPStep = (intCmp > -1 ? BusinessEnum.gc_PDSER_PSTEP_ORDER : strRetPStep);
                        }
                        else if ((xdRefPInv + xdRefPDrNote + DocumentType.TR.ToString() + ",").IndexOf(strRefType) > -1)
                        {
                            //strRetPStep = max( strRetPStep , gc_PDSER_PSTEP_INV );
                            //strRetPStep = BusinessEnum.gc_PDSER_PSTEP_INV;
                            intCmp      = BusinessEnum.gc_PDSER_PSTEP_INV.CompareTo(strRetPStep);
                            strRetPStep = (intCmp > -1 ? BusinessEnum.gc_PDSER_PSTEP_INV : strRetPStep);
                        }
                        else if ((xdRefPCrNote).IndexOf(strRefType) > -1)
                        {
                            //strRetPStep = max( strRetPStep , gc_PDSER_PSTEP_RETURN );
                            //strRetPStep = BusinessEnum.gc_PDSER_PSTEP_RETURN;
                            intCmp      = BusinessEnum.gc_PDSER_PSTEP_RETURN.CompareTo(strRetPStep);
                            strRetPStep = (intCmp > -1 ? BusinessEnum.gc_PDSER_PSTEP_RETURN : strRetPStep);
                        }
                    }
                }
            }
            return(strRetPStep);
        }
Example #2
0
        /// <summary>
        /// Get step ¢ÒÂÅèÒÊØ´¢Í§ serial ¹Õé
        /// </summary>
        /// <param name="inSQLHelper"></param>
        /// <param name="inPdSer"></param>
        /// <param name="inForRecalChkDelRefPdX3"></param>
        /// <returns></returns>
        public static string GetPdSerSStep(WS.Data.Agents.cDBMSAgent inSQLHelper, System.Data.IDbConnection inDbConn, System.Data.IDbTransaction inDbTran, string inPdSer, bool inForRecalChkDelRefPdX3)
        {
            string   strErrorMsg = "";
            DateTime ldMaxDate   = DateTime.MinValue;

            string xdRefSInv    = DocumentType.SI.ToString() + "," + DocumentType.SQ.ToString() + "," + DocumentType.SR.ToString() + "," + DocumentType.SU.ToString() + "," + DocumentType.SV.ToString() + "," + DocumentType.SY.ToString() + "," + DocumentType.SG.ToString() + ",";
            string xdRefSDrNote = DocumentType.SD.ToString() + "," + DocumentType.SX.ToString() + "," + DocumentType.SB.ToString() + "," + DocumentType.SZ.ToString() + ",";
            string xdRefSCrNote = DocumentType.SC.ToString() + "," + DocumentType.SA.ToString() + "," + DocumentType.SM.ToString() + "," + DocumentType.SN.ToString() + ",";

            string  strRetSStep = BusinessEnum.gc_PDSER_SSTEP_FREE;
            DataSet dtsTem      = new DataSet();

            //inSQLHelper.SetPara(new object[] {inPdSer});
            //if (inSQLHelper.SQLExec(ref dtsTem, "QRefPdX3", MapTable.Table.RefPdX3, "select * from "+MapTable.Table.RefPdX3+" where fcPdSer = ? " , ref strErrorMsg))
            if (inSQLHelper.BatchSQLExec(ref dtsTem, "QRefPdX3", MapTable.Table.RefPdX3, "select * from " + MapTable.Table.RefPdX3 + " where fcPdSer = ? ", new object[] { inPdSer }, ref strErrorMsg, inDbConn, inDbTran))
            {
                foreach (DataRow dtrRefPdX3 in dtsTem.Tables["QRefPdX3"].Rows)
                {
                    if (inForRecalChkDelRefPdX3)
                    {
                    }
                    else
                    {
                        string strRefType = dtrRefPdX3["fcRefType"].ToString();
                        string strRefItem = dtrRefPdX3["fcRefItem"].ToString();

                        //àÍ¡ÊÒà Invoice ¢Ò ¡Ñº ãºà¾ÔèÁ˹Õé¢ÒÂ
                        if ((xdRefSInv + xdRefSDrNote).IndexOf(strRefType) > -1 &&
                            inSQLHelper.BatchSQLExec(ref dtsTem, "QRefProd", MapTable.Table.RefProd, "select fdDate from " + MapTable.Table.RefProd + " where fcSkid = ? ", new object[] { strRefItem }, ref strErrorMsg, inDbConn, inDbTran) &&
                            Convert.ToDateTime(dtsTem.Tables["QRefProd"].Rows[0]["fdDate"]).Date.CompareTo(ldMaxDate.Date) > -1)
                        {
                            ldMaxDate   = Convert.ToDateTime(dtsTem.Tables["QRefProd"].Rows[0]["fdDate"]);
                            strRetSStep = BusinessEnum.gc_PDSER_SSTEP_INV;
                        }
                        //àÍ¡ÊÒà ãºÅ´Ë¹Õé¢ÒÂ
                        else if ((xdRefSCrNote).IndexOf(strRefType) > -1 &&
                                 inSQLHelper.BatchSQLExec(ref dtsTem, "QRefProd", MapTable.Table.RefProd, "select fdDate from " + MapTable.Table.RefProd + " where fcSkid = ? ", new object[] { strRefItem }, ref strErrorMsg, inDbConn, inDbTran) &&
                                 Convert.ToDateTime(dtsTem.Tables["QRefProd"].Rows[0]["fdDate"]).Date.CompareTo(ldMaxDate.Date) > -1)
                        {
                            ldMaxDate   = Convert.ToDateTime(dtsTem.Tables["QRefProd"].Rows[0]["fdDate"]);
                            strRetSStep = BusinessEnum.gc_PDSER_SSTEP_FREE;
                        }
                        //àÍ¡ÊÒà ãºÂ×Á
                        else if ((DocumentType.SS.ToString()).IndexOf(strRefType) > -1 &&
                                 inSQLHelper.BatchSQLExec(ref dtsTem, "QOrderI", MapTable.Table.OrderI, "select fdDate from " + MapTable.Table.OrderI + " where fcSkid = ? ", new object[] { strRefItem }, ref strErrorMsg, inDbConn, inDbTran) &&
                                 Convert.ToDateTime(dtsTem.Tables["QOrderI"].Rows[0]["fdDate"]).Date.CompareTo(ldMaxDate.Date) > -1)
                        {
                            ldMaxDate   = Convert.ToDateTime(dtsTem.Tables["QOrderI"].Rows[0]["fdDate"]);
                            strRetSStep = BusinessEnum.gc_PDSER_SSTEP_INV;
                        }
                        //àÍ¡ÊÒà SO
                        else if ((DocumentType.SO.ToString()).IndexOf(strRefType) > -1 &&
                                 inSQLHelper.BatchSQLExec(ref dtsTem, "QOrderI", MapTable.Table.OrderI, "select fdDate from " + MapTable.Table.OrderI + " where fcSkid = ? ", new object[] { strRefItem }, ref strErrorMsg, inDbConn, inDbTran) &&
                                 Convert.ToDateTime(dtsTem.Tables["QOrderI"].Rows[0]["fdDate"]).Date.CompareTo(ldMaxDate.Date) > -1)
                        {
                            ldMaxDate   = Convert.ToDateTime(dtsTem.Tables["QOrderI"].Rows[0]["fdDate"]);
                            strRetSStep = BusinessEnum.gc_PDSER_SSTEP_ORDER;
                        }
                        //àÍ¡ÊÒûÃѺÂÍ´Å´ (AJ)
                        else if ((DocumentType.AJ.ToString()).IndexOf(strRefType) > -1 &&
                                 inSQLHelper.BatchSQLExec(ref dtsTem, "QRefProd", MapTable.Table.RefProd, "select fcIOType, fdDate from " + MapTable.Table.RefProd + " where fcSkid = ? ", new object[] { strRefItem }, ref strErrorMsg, inDbConn, inDbTran) &&
                                 dtsTem.Tables["QRefProd"].Rows[0]["fcIOType"].ToString() == "O" &&
                                 Convert.ToDateTime(dtsTem.Tables["QRefProd"].Rows[0]["fdDate"]).Date.CompareTo(ldMaxDate.Date) > -1)
                        {
                            ldMaxDate   = Convert.ToDateTime(dtsTem.Tables["QRefProd"].Rows[0]["fdDate"]);
                            strRetSStep = BusinessEnum.gc_PDSER_SSTEP_INV;
                        }
                    }
                }
            }
            return(strRetSStep);
        }