Пример #1
0
 public PDProductData GetData(double loid)
 {
     PDProductData data = new PDProductData();
     if (DALObj.GetDataByLOID(loid, null))
     {
         data.LOID = DALObj.LOID;
         data.PRODSTATUS = DALObj.PRODSTATUS;
         data.LOTNO = DALObj.LOTNO;
         data.CREATEBY = DALObj.CREATEBY;
         data.SENDQCDATE = DALObj.SENDQCDATE;
         data.PDORDER = DALObj.PDORDER;
         PDOrderDAL PDDAL = new PDOrderDAL();
         PDDAL.GetDataByLOID(data.PDORDER, null);
         data.ANACODE = PDDAL.ANACODE;
         data.ANADATE = PDDAL.ANADATE;
     }
     return data;
 }
Пример #2
0
        public bool NewPDOrder(string UserID, PurchaseOrderData data)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                PDOrderDAL _DAL = new PDOrderDAL();
                _DAL.OnDB = false;
                _DAL.ACTIVE = data.ACTIVE;
                _DAL.CODE = data.CODE;
                _DAL.ORDERDATE = data.ORDERDATE;
                _DAL.STATUS = data.STATUS;
                _DAL.VAT = data.VAT;
                _DAL.ORDERTYPE = Constz.OrderType.PO.Code;
                _DAL.POTYPE = "N";

                ret = _DAL.InsertCurrentData(UserID, obj.zTrans);
                _LOID = _DAL.LOID;
                if (!ret)
                {
                    throw new ApplicationException(_DAL.ErrorMessage);
                }
                
                POItemDAL _DALItem = new POItemDAL();
                for (int i = 0; i < data.ITEM.Count; ++i)
                {
                    _DALItem.OnDB = false;
                    POItemData itemData = (POItemData)data.ITEM[i];
                    
                    _DALItem.PRODUCT = itemData.PRODUCT;
                    _DALItem.PRITEM = itemData.PRITEM;
                    _DALItem.PDORDER = _DAL.LOID;
                    _DALItem.QTY = itemData.QTY;
                    _DALItem.UNIT = itemData.UNIT;
                    _DALItem.PRICE = itemData.PRICE;
                    _DALItem.DUEDATE = DateTime.Now.Date;
                    _DALItem.ACTIVE = itemData.ACTIVE;

                    ret = _DALItem.InsertCurrentData(UserID, obj.zTrans);
                    if (!ret)
                    {
                        throw new ApplicationException(_DALItem.ErrorMessage);
                    }
                }
                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }

            return ret;

        }
Пример #3
0
 public StockInPOData GetStockInPOData(double loid, double PDOrder)
 {
     StockInPOData data = new StockInPOData();
     data.PDORDER = PDOrder;
     DataTable dt = PODALObj.GetStockInPOData(loid);
     if (dt.Rows.Count == 1)
     {
         data.CODE = dt.Rows[0]["CODE"].ToString();
         data.INVNO = dt.Rows[0]["INVNO"].ToString();
         data.LOID = Convert.ToDouble(dt.Rows[0]["LOID"]);
         data.SENDER = Convert.ToDouble(dt.Rows[0]["SENDER"]);
         data.STATUS = dt.Rows[0]["STATUS"].ToString();
         data.SUPPLIERNAME = dt.Rows[0]["SUPPLIERNAME"].ToString();
     }
     PDOrderDAL _orderDAL = new PDOrderDAL();
     if (_orderDAL.GetDataByLOID(PDOrder, null))
     {
         data.ORDERCODE = _orderDAL.CODE;
     }
     return data;
 }
Пример #4
0
        public static bool Update_StatusRR(string UserID, PDProductData PdpData, PDOrderData PoData, string PdpLoid, string PoLoid)
        {
            bool ret = true;
            bool rr = true;
            PDProductDAL pdDAL = new PDProductDAL();
            pdDAL.GetDataByLOID(Convert.ToDouble(PdpLoid), null);
            pdDAL.PRODSTATUS = PdpData.PRODSTATUS;
            pdDAL.RADIATERETQTY = PdpData.RADIATERETQTY;
            pdDAL.RADIATERETREMARK = PdpData.RADIATERETREMARK;
            pdDAL.RADIATERETUNIT = PdpData.RADIATERETUNIT;

            if (PdpData.RADIATERETDATE.Year.ToString() != "1" || PdpData.RADIATERETDATE.ToString() != "")
                pdDAL.RADIATERETDATE = PdpData.RADIATERETDATE;

            ret = pdDAL.UpdateCurrentData(UserID, null);
            //=========================================================//
            PDOrderDAL PoDAL = new PDOrderDAL();
            PoDAL.GetDataByLOID(Convert.ToDouble(PoLoid), null);
            string status = PoData.STATUS;
            PoDAL.STATUS = PoData.STATUS;
            rr = PoDAL.UpdateCurrentData(UserID, null);
            if (ret == true && rr == true)
                return true;
            else
                return false;
        }
Пример #5
0
        public static bool Update_StatusRD(string UserID, PDProductData PdpData, PDOrderData PoData, string PdpLoid, string PoLoid)
        {
            bool ret = true;
            bool rr = true;
            PDProductDAL pdDAL = new PDProductDAL();
            pdDAL.GetDataByLOID(Convert.ToDouble(PdpLoid), null);
            pdDAL.PRODSTATUS  = PdpData.PRODSTATUS;

            if (PdpData.PRODSTATUS == "QS")
            {
                pdDAL.QUARANTINEQTY = PdpData.QUARANTINEQTY;
                pdDAL.QUARANTINEREMARK = PdpData.QUARANTINEREMARK;
                if (PdpData.QUARANTINEDATE.Year.ToString() != "1" & PdpData.QUARANTINEDATE.ToString() != "")
                    pdDAL.QUARANTINEDATE = PdpData.QUARANTINEDATE;
            }
            else if (PdpData.PRODSTATUS == "RD")
            { 
                pdDAL.RADIATEQTY = PdpData.RADIATEQTY;
                pdDAL.RADIATEREMARK = PdpData.RADIATEREMARK;
                pdDAL.RADIATEUNIT = PdpData.RADIATEUNIT;
                if (PdpData.RADIATEDATE.Year.ToString() != "1" & PdpData.RADIATEDATE.ToString() != "")
                    pdDAL.RADIATEDATE = PdpData.RADIATEDATE;
            }
            else if (PdpData.PRODSTATUS == "AP")
            {
                pdDAL.SENDFGREMARK = PdpData.SENDFGREMARK;
                pdDAL.SENDFGQTY = PdpData.SENDFGQTY;
                if (PdpData.SENDFGDATE.Year.ToString() != "1" & PdpData.SENDFGDATE.ToString() != "")
                    pdDAL.SENDFGDATE = PdpData.SENDFGDATE;
            }
            else if (PdpData.PRODSTATUS == "QC")
            {
                if (PdpData.SENDQCDATE.Year.ToString() != "1" & PdpData.SENDQCDATE.ToString() != "")
                    pdDAL.SENDQCDATE = PdpData.SENDQCDATE;
            }
            


            ret = pdDAL.UpdateCurrentData(UserID, null);
            //=========================================================//
            PDOrderDAL PoDAL = new PDOrderDAL();
            PoDAL.GetDataByLOID(Convert.ToDouble(PoLoid), null);
            string status = PoData.STATUS;
            PoDAL.STATUS = PoData.STATUS;
            rr = PoDAL.UpdateCurrentData(UserID, null);
            if (status == Constz.Requisition.Status.RW.Code)
                rr = PoDAL.CutStockQS(Convert.ToDouble(PoLoid), UserID ,null);
            else if (status == Constz.Requisition.Status.XRay.Code)
                rr = PoDAL.CutStockItemQS(Convert.ToDouble(PoLoid), UserID, null);
            else if (status == Constz.Requisition.Status.QC.Code || status == Constz.Requisition.Status.QS.Code)
                rr = PoDAL.CutStock(Convert.ToDouble(PoLoid), UserID, null);

            if (ret == true && rr == true)
                return true;
            else
                return false;
        }
Пример #6
0
        public bool DeleteData(ArrayList arrLOID)
        {
            bool ret = true;
            OracleDBObj objDB = new OracleDBObj();

            objDB.CreateConnection();
            objDB.CreateTransaction();

            try
            {
                foreach (double PDPLOID in arrLOID)
                {
                    //Delete MaterialItem
                    MaterialItemDAL oDAL = new MaterialItemDAL();
                    double  mtloid = GetMetrialItemLoid(PDPLOID);
                    oDAL.GetDataByLOID(mtloid, objDB.zTrans);
                    oDAL.DeleteCurrentData(objDB.zTrans);

                    //Delete PdProduct
                    PDProductDAL pDAL = new PDProductDAL();
                    pDAL.GetDataByLOID(PDPLOID, objDB.zTrans);
                    pDAL.DeleteCurrentData(objDB.zTrans);

                    //Delete PdOrder
                    PDOrderDAL poDAL = new PDOrderDAL();
                    double poloid = GetPdOrderLoid(PDPLOID);
                    poDAL.GetDataByLOID(poloid, objDB.zTrans);
                    poDAL.DeleteCurrentData(objDB.zTrans);
                }
                objDB.zTrans.Commit();
                ret = true;
            }
            catch (Exception ex)
            {
                objDB.zTrans.Rollback();
                _error = ex.Message;
                ret = false;
            }

            objDB.CloseConnection();
            return ret;
        }
Пример #7
0
 public static bool UpdatePdOrder(string UserID, PDOrderData data,double PoLoid)
 {
     PDOrderDAL poDAL = new PDOrderDAL();
     poDAL.GetDataByLOID(PoLoid, null);
     poDAL.REMARK = data.REMARK;
     poDAL.SUPPLIER = Constz.ProductionDepartment.LOID;
     bool ret = poDAL.UpdateCurrentData(UserID, null);
     return ret;
 }
Пример #8
0
 public static double InsertPdOrder(string UserID,string Remark,string reftable, double refloid)
 {
     double POLoid = 0;
     PDOrderDAL poDAL = new PDOrderDAL();
     poDAL.REMARK = Remark.Trim();
     poDAL.ORDERTYPE = "PD";
     poDAL.ACTIVE = "1";
     poDAL.STATUS = "WA";
     poDAL.POTYPE = "N";
     poDAL.SUPPLIER = Constz.ProductionDepartment.LOID;
     poDAL.REFLOID = refloid;
     poDAL.REFTABLE = reftable;
     bool ret = poDAL.InsertCurrentData(UserID, null);
     if (ret == true)
     {
         POLoid = poDAL.LOID;
         return POLoid;
     }
     else
         return 0;     
 }
Пример #9
0
        public bool UpdateStockOutStatus(string userID, double stockOut, string status)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                DALObj.OnDB = false;
                DALObj.GetDataByLOID(stockOut, obj.zTrans);
                DALObj.STATUS = status;

                if (DALObj.OnDB)
                    ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                if (!ret) throw new ApplicationException(DALObj.ErrorMessage);

                RequisitionDAL rDAL = new RequisitionDAL();
                rDAL.GetDataByLOID(DALObj.REFLOID, obj.zTrans);
                rDAL.ACTIVE = Constz.ActiveStatus.InActive;
                if (rDAL.OnDB)
                    ret = rDAL.UpdateCurrentData(userID, obj.zTrans);
                if (!ret) throw new ApplicationException(rDAL.ErrorMessage);

                ret = DALItemObj.UpdateStatusByStockOut(stockOut, status, userID, obj.zTrans);
                if (!ret) throw new ApplicationException(DALItemObj.ErrorMessage);

                PDProductDAL pdDAL = new PDProductDAL();
                pdDAL.GetDataByLOID(rDAL.REFLOID, obj.zTrans);

                PDOrderDAL poDAL = new PDOrderDAL();
                poDAL.GetDataByLOID(pdDAL.PDORDER, obj.zTrans);
                poDAL.STATUS = Constz.Requisition.Status.RW.Code;
                ret = poDAL.UpdateCurrentData(userID, obj.zTrans);
                if (!ret) throw new ApplicationException(poDAL.ErrorMessage);

                ret = DALObj.CutStock(stockOut, userID, obj.zTrans);
                if (!ret) throw new ApplicationException(DALObj.ErrorMessage);

                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }
            return ret;
        }
Пример #10
0
        public bool UpdateData(string userID, StockinQCData data)
        {
            bool ret = true;
            if (ValidateData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    DALObj.OnDB = false;
                    DALObj.GetDataByLOID(data.LOID, obj.zTrans);
                    data.PDORDERLOID= DALObj.PDORDER ;

                    PDOrderDAL PDDAL = new PDOrderDAL();
                    PDDAL.GetDataByLOID(data.PDORDERLOID, null);

                    PDDAL.ANACODE = data.ANACODE;
                    PDDAL.ANADATE = data.ANADATE;

                    if (PDDAL.OnDB)
                        ret = PDDAL.UpdateCurrentData(userID, obj.zTrans);
                    else
                        ret = PDDAL.InsertCurrentData(userID, obj.zTrans);

                    _LOID = PDOrderDALObj.LOID;
                    if (!ret)
                    {
                        throw new ApplicationException(PDOrderDALObj.ErrorMessage);
                    }

                    obj.zTrans.Commit();
                    obj.CloseConnection();
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    _error = ex.Message;
                }
            }
            else
                ret = false;
            return ret;
        }