Beispiel #1
0
        public string InsertMaterial(ref Material material, string userid)
        {
            string resultMsg = string.Empty;

            try
            {
                ProcParam param = new ProcParam(16)
                {
                    ProcedureName = "MASTER_PACK.M_MATERIAL_INS"
                };

                param.AddParamInOutput(0, "strMTL_SEQ_NO", OracleDbType.Varchar2, 255, material.MTL_SEQ_NO); //OracleDbType.Varchar2, prod.PROD_SEQ_NO
                param.AddParamInput(1, "strMTL_CODE", material.MTL_CODE);
                param.AddParamInput(2, "strMTL_NAME", material.MTL_NAME);
                param.AddParamInput(3, "strMTL_GRADE", material.MTL_GRADE);
                param.AddParamInput(4, "strMTL_COLOR", material.MTL_COLOR);
                param.AddParamInput(5, "strUNIT", material.UNIT);
                param.AddParamInput(6, "strSTD_QTY", material.STD_QTY);
                param.AddParamInput(7, "strMIN_QTY", material.MIN_QTY);
                param.AddParamInput(8, "strMAX_QTY", material.MAX_QTY);
                param.AddParamInput(9, "strPARTY_ID", material.PARTY_ID);

                if (material.MTL_IMAGE != null)
                {
                    param.AddParamBLOBInput(10, "strMTL_IMAGE", OracleDbType.Blob, this.BitmapToByteArray(material.MTL_IMAGE)); //this.BitmapToByteArray(prod.PROD_IMAGE)
                }
                else
                {
                    param.AddParamInput(10, "strMTL_IMAGE", DBNull.Value); //this.BitmapToByteArray(prod.PROD_IMAGE)
                }

                param.AddParamInput(11, "strLOCATION_ID", material.LOCATION_ID);
                param.AddParamInput(12, "strREMARK", material.REMARK);
                param.AddParamInput(13, "strUSER_ID", userid);
                param.AddParamInput(14, "strREC_STAT", (material.REC_STAT ? "Y" : "N"));
                param.AddParamOutput(15, "RESULTMSG", OracleDbType.Varchar2, 255);

                GlobalDB.Instance.DataAc.ExecuteNonQuery(param);

                ////this.executionTime = GlobalDB.Instance.DataAc.ExecuteTime;

                OracleString mtlSeq = (OracleString)param.ReturnValue(0);

                OracleString result = (OracleString)param.ReturnValue(15);

                if (!result.IsNull)
                {
                    material.MTL_SEQ_NO = mtlSeq.Value;
                    resultMsg           = result.Value;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(resultMsg);
        }
Beispiel #2
0
        public string InsertParty(ref Party party, string userid)
        {
            string resultMsg = string.Empty;

            try
            {
                ProcParam param = new ProcParam(15);

                param.ProcedureName = "MASTER_PACK.M_PARTY_INS";

                param.AddParamInOutput(0, "strPARTY_ID", OracleDbType.Varchar2, 100, party.PARTY_ID);
                param.AddParamInput(1, "strPARTY_NAME", party.PARTY_NAME);
                param.AddParamInput(2, "strPARTY_TYPE", party.PARTY_TYPE);
                param.AddParamInput(3, "strADD1", party.ADD1);
                param.AddParamInput(4, "strADD2", party.ADD2);
                param.AddParamInput(5, "strADD3", party.ADD3);
                param.AddParamInput(6, "strADD4", party.ADD4);
                param.AddParamInput(7, "strTEL", party.TEL);
                param.AddParamInput(8, "strFAX", party.FAX);
                param.AddParamInput(9, "strEMAIL", party.EMAIL);
                param.AddParamInput(10, "strPIC", party.PIC);
                param.AddParamInput(11, "strREMARK", party.REMARK);
                param.AddParamInput(12, "strREC_STAT", (party.REC_STAT ? "Y" : "N"));
                param.AddParamInput(13, "strUSER_ID", userid);

                param.AddParamOutput(14, "RESULTMSG", OracleDbType.Varchar2, 255);

                GlobalDB.Instance.DataAc.ExecuteNonQuery(param);

                ////this.executionTime = GlobalDB.Instance.DataAc.ExecuteTime;

                OracleString result = (OracleString)param.ReturnValue(14);


                if (!result.IsNull)
                {
                    resultMsg = result.Value;
                    OracleString resultPartyID = (OracleString)param.ReturnValue(0);
                    if (!resultPartyID.IsNull)
                    {
                        party.PARTY_ID = resultPartyID.Value;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(resultMsg);
        }
Beispiel #3
0
        public string InsertTransferOrder(ref TransferOrderHdr TO_HDR, string userid)
        {
            string resultMsg = string.Empty;

            try
            {
                #region "Transaction Header"

                ProcParam paramHDR = new ProcParam(10);

                paramHDR.ProcedureName = "TO_PACK.TO_HDR_INS";

                paramHDR.AddParamInOutput(0, "strTO_NO", OracleDbType.Varchar2, 255, TO_HDR.TO_NO);
                paramHDR.AddParamInput(1, "strTO_DATE ", TO_HDR.TO_DATE);
                paramHDR.AddParamInput(2, "strREF_NO", TO_HDR.REF_NO);
                paramHDR.AddParamInput(3, "strPROD_TYPE", TO_HDR.PROD_TYPE);
                paramHDR.AddParamInput(4, "strTO_DEST", TO_HDR.TO_DEST);
                paramHDR.AddParamInput(5, "strDELIVERY_DATE", TO_HDR.DELIVERY_DATE);
                paramHDR.AddParamInput(6, "strREMARK", TO_HDR.REMARK);


                paramHDR.AddParamInput(7, "strREC_STAT", (TO_HDR.REC_STAT ? "Y" : "N"));
                paramHDR.AddParamInput(8, "strUSER_ID", userid);

                paramHDR.AddParamOutput(9, "RESULTMSG", OracleDbType.Varchar2, 255);

                #endregion

                GlobalDB.Instance.DataAc.ExecuteNonQuery(paramHDR);

                //this.executionTime = GlobalDB.Instance.DataAc.ExecuteTime;

                OracleString resultDB = (OracleString)paramHDR.ReturnValue(0);
                OracleString result   = (OracleString)paramHDR.ReturnValue(9);

                if (!result.IsNull)
                {
                    TO_HDR.TO_NO = resultDB.Value;
                    resultMsg    = result.Value;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(resultMsg);
        }
Beispiel #4
0
        public string InsertLoadingOrder(ref LoadingOrder loadingOrd, string userid)
        {
            string resultMsg = string.Empty;

            try
            {
                #region "Transaction Header"

                ProcParam paramHDR = new ProcParam(10)
                {
                    ProcedureName = "LOADING_PACK.LOADING_HDR_INS"
                };

                paramHDR.AddParamInOutput(0, "strLOADING_NO", OracleDbType.Varchar2, 255, loadingOrd.LOADING_NO);
                paramHDR.AddParamInput(1, "strLOADING_DATE ", loadingOrd.LOADING_DATE);
                paramHDR.AddParamInput(2, "strDELIVERY_DATE", loadingOrd.DELIVERY_DATE);
                paramHDR.AddParamInput(3, "strTRUCK_NO", loadingOrd.TRUCK_NO);
                paramHDR.AddParamInput(4, "strCONTAINER_NO", loadingOrd.CONTAINER_NO);
                paramHDR.AddParamInput(5, "strWH_ID", loadingOrd.WH_ID);
                paramHDR.AddParamInput(6, "strREMARK", loadingOrd.REMARK);
                paramHDR.AddParamInput(7, "strREC_STAT", (loadingOrd.REC_STAT ? "Y" : "N"));
                paramHDR.AddParamInput(8, "strUSER_ID", userid);

                paramHDR.AddParamOutput(9, "RESULTMSG", OracleDbType.Varchar2, 255);

                #endregion

                GlobalDB.Instance.DataAc.ExecuteNonQuery(paramHDR);

                //this.executionTime = GlobalDB.Instance.DataAc.ExecuteTime;

                OracleString resultDB = (OracleString)paramHDR.ReturnValue(0);
                OracleString result   = (OracleString)paramHDR.ReturnValue(9);

                if (!result.IsNull)
                {
                    loadingOrd.LOADING_NO = resultDB.Value;
                    resultMsg             = result.Value;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(resultMsg);
        }
Beispiel #5
0
        public string InsertArrival(T_ARRIVAL_HDR ArrHdr, List <T_ARRIVAL_DTL> lstArrDtl, string userid, out string ARRIVAL_NO)
        {
            string resultMsg = string.Empty;

            ARRIVAL_NO = string.Empty;

            try
            {
                #region "Transaction Header"

                ProcParam procHeader = new ProcParam(11)
                {
                    ProcedureName = "MTL_IN_PACK.T_ARRIVAL_HDR_INS"
                };

                procHeader.AddParamInOutput(0, "strARRIVAL_NO", OracleDbType.NVarchar2, 30, ArrHdr.ARRIVAL_NO);
                procHeader.AddParamInput(1, "strARRIVAL_DATE", ArrHdr.ARRIVAL_DATE);
                procHeader.AddParamInput(2, "strWH_ID", ArrHdr.WH_ID);
                procHeader.AddParamInput(3, "strPARTY_ID", ArrHdr.PARTY_ID);
                procHeader.AddParamInput(4, "strREF_NO ", ArrHdr.REF_NO);
                procHeader.AddParamInput(5, "strREF_DATE", ArrHdr.REF_DATE);
                procHeader.AddParamInput(6, "strREMARK", ArrHdr.REMARK);
                procHeader.AddParamInput(7, "strUSER_ID", ArrHdr.USER_ID);
                procHeader.AddParamInput(8, "strREC_STAT", ArrHdr.REC_STAT ? "Y" : "N");
                procHeader.AddParamInput(9, "strARR_TYPE", ArrHdr.ARR_TYPE);
                procHeader.AddParamOutput(10, "RESULTMSG", OracleDbType.NVarchar2, 255, "OK");


                #endregion "Transaction Header"

                #region "Transaction Detail"

                #region Arrival Insert #Flag=2

                var insArr = from arr in lstArrDtl
                             where arr.FLAG == 2
                             select arr;

                ProcParam paramIns = null;

                if (insArr.Any() && insArr.Count() > 0)
                {
                    paramIns = new ProcParam(10)
                    {
                        ProcedureName = "MTL_IN_PACK.T_ARRIVAL_DTL_INS"
                    };

                    var arrARRIVAL_NO = (from arr in insArr
                                         select arr.ARRIVAL_NO).ToArray();
                    paramIns.AddParamInput(0, "strARRIVAL_NO", arrARRIVAL_NO, OracleDbType.Varchar2);

                    var arrLINE_NO = (from arr in insArr
                                      select(object) arr.LINE_NO).ToArray();
                    paramIns.AddParamInput(1, "strLINE_NO", arrLINE_NO, OracleDbType.Int32);

                    var arrMTL_SEQ_NO = (from arr in insArr
                                         select arr.MTL_SEQ_NO).ToArray();
                    paramIns.AddParamInput(2, "strMTL_SEQ_NO", arrMTL_SEQ_NO, OracleDbType.Varchar2);

                    var arrUNIT_ID = (from arr in insArr
                                      select arr.UNIT_ID).ToArray();
                    paramIns.AddParamInput(3, "strUNIT_ID", arrUNIT_ID, OracleDbType.Varchar2);

                    var arrQTY = (from arr in insArr
                                  select(object) arr.QTY).ToArray();
                    paramIns.AddParamInput(4, "strQTY", arrQTY, OracleDbType.Decimal);

                    var arrREMARK = (from arr in insArr
                                     select arr.REMARK).ToArray();
                    paramIns.AddParamInput(5, "strREMARK", arrREMARK, OracleDbType.Varchar2);

                    //strCREATED_BY
                    paramIns.AddParamInput(6, "strUSER_ID", ArrayOf <object> .Create(insArr.Count(), userid), OracleDbType.Varchar2);

                    //REC_STATUS
                    paramIns.AddParamInput(7, "strREC_STAT", ArrayOf <object> .Create(insArr.Count(), "Y"), OracleDbType.Varchar2);


                    var arrLOT_DATE = (from arr in insArr
                                       select(object) arr.LOT_DATE).ToArray();
                    paramIns.AddParamInput(8, "strLOT_DATE", arrLOT_DATE, OracleDbType.Date);

                    //RESULTMSG
                    paramIns.AddParamOutput(9, "RESULTMSG", OracleDbType.Varchar2, 255, "OK", insArr.Count());
                }

                #endregion

                #endregion

                GlobalDB.Instance.DataAc.ExecuteNonQuery(procHeader, paramIns, insArr.Count(), 0, 0);

                if (GlobalDB.Instance.LastException != null)
                {
                    throw GlobalDB.Instance.LastException;
                }

                OracleString resultKey = (OracleString)procHeader.ReturnValue(0);
                OracleString result    = (OracleString)procHeader.ReturnValue(10);

                if (!resultKey.IsNull)
                {
                    ARRIVAL_NO = resultKey.Value;
                }

                if (!result.IsNull)
                {
                    resultMsg = result.Value;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(resultMsg);
        }
Beispiel #6
0
        public string InsertPlan(string PlanType, DataTable DtExcelPlan_DTL, DateTime planDate, string userid)
        {
            string resultMsg = string.Empty;

            try
            {
                #region Transaction Header

                ProcParam paramHDR = new ProcParam(5)
                {
                    ProcedureName = "UPLOAD_PLAN.UPLOAD_PLAN_HDR_INSERT"
                };

                paramHDR.AddParamInOutput(0, "strPLAN_NO", OracleDbType.Varchar2, 30, "");
                paramHDR.AddParamInput(1, "strUSER_ID", userid);
                paramHDR.AddParamInput(2, "strTYPE", PlanType);
                paramHDR.AddParamInput(3, "strPLAN_DATE", planDate);
                paramHDR.AddParamOutput(4, "RESULTMSG", OracleDbType.NVarchar2, 255);

                #endregion
                #region Transaction Detail

                // DataRow[] insertRows = dtCOMPDtl.Rows;
                ProcParam paramDTL = null;

                if (DtExcelPlan_DTL.Rows.Count > 0)
                {
                    paramDTL = new ProcParam(34)
                    {
                        ProcedureName = "UPLOAD_PLAN.UPLOAD_PLAN_DTL_INSERT"
                    };

                    paramDTL.AddParamInput(0, "strPLAN_NO", ArrayOf <object> .Create(DtExcelPlan_DTL.Rows.Count, ""), OracleDbType.Varchar2);

                    var arrMC_SIZE_TON = (from DataRow row in DtExcelPlan_DTL.Rows
                                          select row["MC_SIZE_TON"]).ToArray();
                    paramDTL.AddParamInput(1, "strMC_SIZE_TON", arrMC_SIZE_TON, OracleDbType.Varchar2);

                    var arrPDTL_BLOCK = (from DataRow row in DtExcelPlan_DTL.Rows
                                         select row["PDTL_BLOCK"]).ToArray();
                    paramDTL.AddParamInput(2, "strPDTL_BLOCK", arrPDTL_BLOCK, OracleDbType.Varchar2);

                    var arrMC_NO = (from DataRow row in DtExcelPlan_DTL.Rows
                                    select row["MC_NO"]).ToArray();
                    paramDTL.AddParamInput(3, "strMC_NO", arrMC_NO, OracleDbType.Varchar2);

                    var arrPDTL_SEQUENCE = (from DataRow row in DtExcelPlan_DTL.Rows
                                            select row["PDTL_SEQUENCE"]).ToArray();
                    paramDTL.AddParamInput(4, "strPDTL_SEQUENCE", arrPDTL_SEQUENCE, OracleDbType.Varchar2);

                    var arrPRODUCT_NO = (from DataRow row in DtExcelPlan_DTL.Rows
                                         select row["PRODUCT_NO"]).ToArray();
                    paramDTL.AddParamInput(5, "strPRODUCT_NO", arrPRODUCT_NO, OracleDbType.Varchar2);
                    if (PlanType == "H")
                    {
                        var arrPARTNAME = (from DataRow row in DtExcelPlan_DTL.Rows
                                           select row["PARTNAME"]).ToArray();
                        paramDTL.AddParamInput(6, "strPARTNAME", arrPARTNAME, OracleDbType.Varchar2);
                    }
                    else
                    {
                        paramDTL.AddParamInput(6, "strPARTNAME", ArrayOf <object> .Create(DtExcelPlan_DTL.Rows.Count, ""), OracleDbType.Varchar2);
                    }
                    var arrMAT_TYPE = (from DataRow row in DtExcelPlan_DTL.Rows
                                       select row["MAT_TYPE"]).ToArray();
                    paramDTL.AddParamInput(7, "strMAT_TYPE", arrMAT_TYPE, OracleDbType.Varchar2);

                    if (PlanType == "V")
                    {
                        var arrINSERT_1 = (from DataRow row in DtExcelPlan_DTL.Rows
                                           select row["INSERT_1"]).ToArray();
                        paramDTL.AddParamInput(8, "strINSERT_1", arrINSERT_1, OracleDbType.Varchar2);

                        var arrINSERT_2 = (from DataRow row in DtExcelPlan_DTL.Rows
                                           select row["INSERT_2"]).ToArray();
                        paramDTL.AddParamInput(9, "strINSERT_2", arrINSERT_2, OracleDbType.Varchar2);

                        var arrINSERT_3 = (from DataRow row in DtExcelPlan_DTL.Rows
                                           select row["INSERT_3"]).ToArray();
                        paramDTL.AddParamInput(10, "strINSERT_3", arrINSERT_3, OracleDbType.Varchar2);

                        var arrTARGET_DAY = (from DataRow row in DtExcelPlan_DTL.Rows
                                             select row["TARGET_DAY"]).ToArray();
                        paramDTL.AddParamInput(24, "strTARGET_DAY", arrTARGET_DAY, OracleDbType.Int32);

                        var arrPROD_LOT = (from DataRow row in DtExcelPlan_DTL.Rows
                                           select row["PROD_LOT"]).ToArray();
                        paramDTL.AddParamInput(27, "strPROD_LOT", arrPROD_LOT, OracleDbType.Varchar2);
                    }
                    else
                    {
                        paramDTL.AddParamInput(8, "strINSERT_1", ArrayOf <object> .Create(DtExcelPlan_DTL.Rows.Count, ""), OracleDbType.Varchar2);
                        paramDTL.AddParamInput(9, "strINSERT_2", ArrayOf <object> .Create(DtExcelPlan_DTL.Rows.Count, ""), OracleDbType.Varchar2);
                        paramDTL.AddParamInput(10, "strINSERT_3", ArrayOf <object> .Create(DtExcelPlan_DTL.Rows.Count, ""), OracleDbType.Varchar2);
                        paramDTL.AddParamInput(24, "strTARGET_DAY", ArrayOf <object> .Create(DtExcelPlan_DTL.Rows.Count, null), OracleDbType.Int32);
                        paramDTL.AddParamInput(27, "strPROD_LOT", ArrayOf <object> .Create(DtExcelPlan_DTL.Rows.Count, ""), OracleDbType.Varchar2);
                    }
                    var arrCAV_ACT = (from DataRow row in DtExcelPlan_DTL.Rows
                                      select row["CAV_ACT"]).ToArray();
                    paramDTL.AddParamInput(11, "strCAV_ACT", arrCAV_ACT, OracleDbType.Int32);

                    var arrCAV_FULL = (from DataRow row in DtExcelPlan_DTL.Rows
                                       select row["CAV_FULL"]).ToArray();
                    paramDTL.AddParamInput(12, "strCAV_FULL", arrCAV_FULL, OracleDbType.Int32);

                    var arrMP_START = (from DataRow row in DtExcelPlan_DTL.Rows
                                       select row["MP_START"]).ToArray();
                    paramDTL.AddParamInput(13, "strMP_START", arrMP_START, OracleDbType.Date);

                    var arrMP_FINISH = (from DataRow row in DtExcelPlan_DTL.Rows
                                        select row["MP_FINISH"]).ToArray();
                    paramDTL.AddParamInput(14, "strMP_FINISH", arrMP_FINISH, OracleDbType.Date);

                    var arrPLAN_MP_DAY = (from DataRow row in DtExcelPlan_DTL.Rows
                                          select row["PLAN_MP_DAY"]).ToArray();
                    paramDTL.AddParamInput(15, "strPLAN_MP_DAY", arrPLAN_MP_DAY, OracleDbType.Decimal);

                    var arrPRO_SHOT_WEIGHT = (from DataRow row in DtExcelPlan_DTL.Rows
                                              select row["PRO_SHOT_WEIGHT"]).ToArray();
                    paramDTL.AddParamInput(16, "strPRO_SHOT_WEIGHT", arrPRO_SHOT_WEIGHT, OracleDbType.Decimal);

                    var arrCYCLE_TIME = (from DataRow row in DtExcelPlan_DTL.Rows
                                         select row["CYCLE_TIME"]).ToArray();
                    paramDTL.AddParamInput(17, "strCYCLE_TIME", arrCYCLE_TIME, OracleDbType.Decimal);

                    var arrQTY_DAY = (from DataRow row in DtExcelPlan_DTL.Rows
                                      select row["QTY_DAY"]).ToArray();
                    paramDTL.AddParamInput(18, "strQTY_DAY", arrQTY_DAY, OracleDbType.Int32);

                    var arrTOTAL_MAT_USE_KG = (from DataRow row in DtExcelPlan_DTL.Rows
                                               select row["TOTAL_MAT_USE_KG"]).ToArray();
                    paramDTL.AddParamInput(19, "strTOTAL_MAT_USE_KG", arrTOTAL_MAT_USE_KG, OracleDbType.Decimal);

                    var arrTPCT_LOSS = (from DataRow row in DtExcelPlan_DTL.Rows
                                        select row["TPCT_LOSS"]).ToArray();
                    paramDTL.AddParamInput(20, "strTPCT_LOSS", arrTPCT_LOSS, OracleDbType.Decimal);

                    var arrQTY_PLAN = (from DataRow row in DtExcelPlan_DTL.Rows
                                       select row["QTY_PLAN"]).ToArray();
                    paramDTL.AddParamInput(21, "strQTY_PLAN", arrQTY_PLAN, OracleDbType.Int32);

                    var arrPLAN_MAT_AVG_DAY_KG = (from DataRow row in DtExcelPlan_DTL.Rows
                                                  select row["PLAN_MAT_AVG_DAY_KG"]).ToArray();
                    paramDTL.AddParamInput(22, "strPLAN_MAT_AVG_DAY_KG", arrPLAN_MAT_AVG_DAY_KG, OracleDbType.Decimal);

                    var arrMAT_DRY = (from DataRow row in DtExcelPlan_DTL.Rows
                                      select row["MAT_DRY"]).ToArray();
                    paramDTL.AddParamInput(23, "strMAT_DRY", arrMAT_DRY, OracleDbType.NVarchar2);

                    var arrPDTL_REMARK = (from DataRow row in DtExcelPlan_DTL.Rows
                                          select row["PDTL_REMARK"]).ToArray();
                    paramDTL.AddParamInput(25, "strPDTL_REMARK", arrPDTL_REMARK, OracleDbType.Varchar2);

                    var arrPARTY_ID = (from DataRow row in DtExcelPlan_DTL.Rows
                                       select row["PARTY_ID"]).ToArray();
                    paramDTL.AddParamInput(26, "strPARTY_ID", arrPARTY_ID, OracleDbType.Varchar2);



                    paramDTL.AddParamInput(28, "strN_USER_ID", ArrayOf <object> .Create(DtExcelPlan_DTL.Rows.Count, userid), OracleDbType.Varchar2);

                    var arrPROD_SEQ_NO = (from DataRow row in DtExcelPlan_DTL.Rows
                                          select row["PROD_SEQ_NO"]).ToArray();
                    paramDTL.AddParamInput(29, "strPROD_SEQ_NO", arrPROD_SEQ_NO, OracleDbType.Varchar2);

                    paramDTL.AddParamInput(30, "strCHANGE_MOLD", ArrayOf <object> .Create(DtExcelPlan_DTL.Rows.Count, 'N'), OracleDbType.Varchar2);
                    paramDTL.AddParamInput(31, "strCONTINUE_ORDER", ArrayOf <object> .Create(DtExcelPlan_DTL.Rows.Count, 'N'), OracleDbType.Varchar2);
                    paramDTL.AddParamInput(32, "strREVISED_PLAN", ArrayOf <object> .Create(DtExcelPlan_DTL.Rows.Count, 'N'), OracleDbType.Varchar2);
                    //RESULTMSG
                    paramDTL.AddParamOutput(33, "RESULTMSG", OracleDbType.NVarchar2, 255, "OK", DtExcelPlan_DTL.Rows.Count);
                }

                #endregion
                GlobalDB.Instance.DataAc.ExecuteNonQuery(paramHDR, paramDTL, DtExcelPlan_DTL.Rows.Count, 0, 0);
                // GlobalDB.Instance.DataAc.ExecuteNonQuery(paramHDR, paramDTL, lstCOMPDtl.Count,0,0);
                if (GlobalDB.Instance.LastException != null)
                {
                    throw GlobalDB.Instance.LastException;
                }

                OracleString result = (OracleString)paramHDR.ReturnValue(4);


                if (!result.IsNull)
                {
                    resultMsg = result.Value;
                }
            }
            catch (Exception ex) {
                throw ex;
            }
            return(resultMsg);
        }
Beispiel #7
0
        public string InsertProduct(ref Product prod, string userid)
        {
            string resultMsg = string.Empty;

            try
            {
                ProcParam param = new ProcParam(17)
                {
                    ProcedureName = "MASTER_PACK.M_PRODUCT_INS"
                };

                param.AddParamInOutput(0, "strPROD_SEQ_NO", OracleDbType.Varchar2, 255, prod.PROD_SEQ_NO); //OracleDbType.Varchar2, prod.PROD_SEQ_NO
                param.AddParamInput(1, "strPRODUCT_NO", prod.PRODUCT_NO);
                param.AddParamInput(2, "strPRODUCT_NAME", prod.PRODUCT_NAME);
                param.AddParamInput(3, "strMATERIAL_TYPE", prod.MATERIAL_TYPE);
                param.AddParamInput(4, "strPRODUCTION_TYPE", prod.PRODUCTION_TYPE);
                param.AddParamInput(5, "strMC_NO", prod.MC_NO);
                param.AddParamInput(6, "strBOX_QTY", prod.BOX_QTY);
                param.AddParamInput(7, "strUNIT", prod.UNIT);
                if (prod.PROD_IMAGE != null)
                {
                    param.AddParamBLOBInput(8, "strPROD_IMAGE", OracleDbType.Blob, this.BitmapToByteArray(prod.PROD_IMAGE)); //this.BitmapToByteArray(prod.PROD_IMAGE)
                }
                else
                {
                    param.AddParamInput(8, "strPROD_IMAGE", DBNull.Value); //this.BitmapToByteArray(prod.PROD_IMAGE)
                }
                param.AddParamInput(9, "strREMARK", prod.REMARK);

                param.AddParamInput(10, "strREC_STAT", (prod.REC_STAT ? "Y" : "N"));
                param.AddParamInput(11, "strUSER_ID", userid);

                //add new parameter on 07-Jun-2011
                param.AddParamInput(12, "strCUST_PROD_NO", prod.CUST_PROD_NO);
                param.AddParamInput(13, "strBUYER", prod.BUYER_PRICE);
                param.AddParamInput(14, "strSELLING", prod.SELLING_PRICE);
                param.AddParamInput(15, "strCOST", prod.COST_PRICE);

                param.AddParamOutput(16, "RESULTMSG", OracleDbType.Varchar2, 255);

                GlobalDB.Instance.DataAc.ExecuteNonQuery(param);

                ////this.executionTime = GlobalDB.Instance.DataAc.ExecuteTime;

                OracleString prodSeq = (OracleString)param.ReturnValue(0);

                OracleString result = (OracleString)param.ReturnValue(16);

                if (!result.IsNull)
                {
                    prod.PROD_SEQ_NO = prodSeq.Value;
                    resultMsg        = result.Value;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(resultMsg);
        }
Beispiel #8
0
        public string InsertDeliveryOrder(ref DeliveryOrder delOrd, string userid)
        {
            string resultMsg = string.Empty;

            try
            {
                #region "Transaction Header"

                ProcParam paramHDR = new ProcParam(10)
                {
                    ProcedureName = "DO_PACK.DO_HDR_INS"
                };

                paramHDR.AddParamInOutput(0, "strDO_NO", OracleDbType.Varchar2, 255, delOrd.DO_NO);
                paramHDR.AddParamInput(1, "strDO_DATE ", delOrd.DO_DATE);
                paramHDR.AddParamInput(2, "strREF_NO", delOrd.REF_NO);
                paramHDR.AddParamInput(3, "strPROD_TYPE", delOrd.PROD_TYPE);
                paramHDR.AddParamInput(4, "strTO_DEST", delOrd.TO_DEST);
                paramHDR.AddParamInput(5, "strDELIVERY_DATE", delOrd.DELIVERY_DATE);
                paramHDR.AddParamInput(6, "strREMARK", delOrd.REMARK);
                paramHDR.AddParamInput(7, "strREC_STAT", (delOrd.REC_STAT ? "Y" : "N"));
                paramHDR.AddParamInput(8, "strUSER_ID", userid);
                paramHDR.AddParamOutput(9, "RESULTMSG", OracleDbType.Varchar2, 255);

                #endregion

                #region "Transcation Detail"

                List <ProcParam> lstParam = new List <ProcParam>();
                ProcParam        paramDTL = null;

                foreach (DeliveryOrderDtl delDtl in delOrd.DELIVERY_ORD_DTL)
                {
                    paramDTL = new ProcParam(8);
                    paramDTL.ProcedureName = "DO_PACK.DO_DTL_INS";

                    paramDTL.AddParamInput(0, "strDO_NO", DBNull.Value);
                    paramDTL.AddParamInput(1, "strPROD_SEQ_NO", delDtl.PROD_SEQ_NO);
                    paramDTL.AddParamInput(2, "strQTY", delDtl.QTY);
                    paramDTL.AddParamInput(3, "strUNIT_ID", delDtl.UNIT_ID);
                    paramDTL.AddParamInput(4, "strREMARK", delDtl.REMARK);
                    paramDTL.AddParamInput(5, "strREC_STAT ", "Y"); //default is 'Y'
                    paramDTL.AddParamInput(6, "strUSER_ID", userid);
                    paramDTL.AddParamOutput(7, "RESULTMSG", OracleDbType.NVarchar2, 255, "OK");

                    lstParam.Add(paramDTL);
                }
                #endregion


                GlobalDB.Instance.DataAc.ExecuteNonQuery(paramHDR, lstParam, 0, 0);

                ////this.executionTime = GlobalDB.Instance.DataAc.ExecuteTime;

                OracleString resultDB = (OracleString)paramHDR.ReturnValue(0);
                OracleString result   = (OracleString)paramHDR.ReturnValue(9);

                if (!result.IsNull)
                {
                    delOrd.DO_NO = resultDB.Value;
                    resultMsg    = result.Value;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(resultMsg);
        }