private void SearchData()
    {

        ReturnRequestFlow flow = new ReturnRequestFlow();
        ReturnRequestData data = new ReturnRequestData();
        data.LOTNO = this.txtLotno.Text.Trim();
        data.PRODUCT = this.cmbProduct.SelectedValue;

        this.grvRequisition.DataSource = flow.GetPopUpList(data);

        this.grvRequisition.DataBind();
        // this.btnSelect.Visible = (this.grvReserve.Rows.Count > 0);
        if (this.grvRequisition.SelectedValue == null)
            this.txtRef.Text = "";
        else
            this.txtRef.Text = this.grvRequisition.SelectedValue.ToString();
    }
Beispiel #2
0
        public ReturnRequestData DoGetRefData(double loid)
        {
            string sql = "SELECT PDP.LOTNO,PD.NAME,PD.BARCODE FROM PDPRODUCT PDP ";
           // sql += "INNER JOIN REQUISITION RQ ON RQ.REFTABLE = 'PDPRODUCT' AND PDP.LOID = RQ.REFLOID ";
            sql += "INNER JOIN PRODUCT PD ON PDP.PRODUCT = PD.LOID ";
            sql += "WHERE PDP.LOID = '" + loid + "'";
            DataTable dt = OracleDB.ExecListCmd(sql);
            ReturnRequestData data = new ReturnRequestData();
            if (dt.Rows.Count > 0)
            {
                data.LOTNO = dt.Rows[0]["LOTNO"].ToString();
                data.PDNAME = dt.Rows[0]["NAME"].ToString();
                data.PDBARCODE = dt.Rows[0]["BARCODE"].ToString();
            }

            return data;
        }
Beispiel #3
0
        public DataTable GetPopUpList(ReturnRequestData data)
        {
            string whereString = "";

           if (data.PRODUCT.Trim() != "0")
                whereString += (whereString == "" ? "" : "AND ") + "PRODUCT = '" + OracleDB.QRText(data.PRODUCT.Trim()) + "' ";
            if (data.LOTNO.Trim() != "")
                whereString += (whereString == "" ? "" : "AND ") + "LOTNO = '" + OracleDB.QRText(data.LOTNO.Trim()) + "' ";

            string sql = "select * from (SELECT ROWNUM NO, PDP.LOID, PD.LOID PRODUCT, PD.BARCODE, PD.NAME PRODUCTNAME, PDP.LOTNO ";
            sql += "FROM PDPRODUCT PDP ";
            sql += "INNER JOIN PRODUCT PD ON PDP.PRODUCT = PD.LOID WHERE PDP.PRODSTATUS IN ('RD','RR','QB','QC','QS','AP')) ";
            sql += (whereString == "" ? "" : "WHERE " + whereString);
            sql += "ORDER BY NO ";

            DataTable dt = OracleDB.ExecListCmd(sql);
            //for (int i = 0; i < dt.Rows.Count; ++i)
            //{
            //    dt.Rows[i]["NO"] = i + 1;
            //}
            return dt;
        }
Beispiel #4
0
        //public bool CopyPDRequest(string userID, double loidSource)
        //{
        //    PDReserveData data = GetData(loidSource);
        //    DataTable itemList = GetPDItem(data.LOID);
        //    ArrayList arr = new ArrayList();
        //    foreach (DataRow dRow in itemList.Rows)
        //    {
        //        PDReserveItemData idata = new PDReserveItemData();
        //        idata.MASTER = Convert.ToDouble(dRow["MASTER"]);
        //        idata.ACTIVE = Constz.ActiveStatus.Active;
        //        arr.Add(idata);
        //    }
        //    data.ITEM = arr;
        //    DALObj.OnDB = false;
        //    data.LOID = 0;
        //    data.CODE = "";
        //    data.STATUS = Constz.Requisition.Status.Waiting.Code;
        //    //data.ACTIVE = Constz.ActiveStatus.Active;
        //    //data.ORDERTYPE = Constz.OrderType.PO.Code;
        //    return UpdateData(userID, data);
        //}

        public bool CommitData(string userID, ReturnRequestData data)
        {
            bool ret = true;
            if (ValidateData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    UpdateData(userID, data);

                    ret = DALObj.CutStockRequisition(_LOID, 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;
                }
            }
            else
                ret = false;
            return ret;
        }
Beispiel #5
0
        public bool UpdateData(string userID, ReturnRequestData data)
        {

            // ####### UPDATE REQUISITION
            bool ret = true;
            if (ValidateData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();

                //if (data.LOID != 0)
                //{
                //    // update old requisition
                //    DALObj.GetDataByLOID(data.LOID, obj.zTrans);
                //}
                //else
                //{
                //    DALObj.STATUS = data.STATUS;
                //    DALObj.ACTIVE = data.ACTIVE;
                //    DALObj.REFTABLE = "PDPRODUCT";
                //    DALObj.REFLOID = data.VPLOID;
                //    DALObj.LOTNO = data.LOTNO;
                //    DALObj.WAREHOUSE = data.WAREHOUSE;
                //}

                try
                {
                    DALObj.OnDB = false;
                    DALObj.GetDataByLOID(data.LOID, obj.zTrans);

                    DALObj.CODE = data.CODE;
                    DALObj.REQDATE = data.REQDATE;
                    DALObj.STATUS = data.STATUS;
                    DALObj.ACTIVE = data.ACTIVE;
                    DALObj.REFTABLE = data.REFTABLE;
                    DALObj.REFLOID = data.REFLOID;
                    DALObj.LOTNO = data.LOTNO;
                    DALObj.WAREHOUSE = data.WAREHOUSE;
                    DALObj.REMARK = data.REMARK;
                    DALObj.REQUISITIONTYPE = data.REQUISITIONTYPE;


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

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


                    // ############ UPDATE ITEM
                    ProductMaterial itemDAL = new ProductMaterial();
                    itemDAL.DeleteCurrentDataByREQ(DALObj.LOID, obj.zTrans);
                    for (Int16 i = 0; i < data.ITEM.Count; ++i)
                    {
                        itemDAL = new ProductMaterial();
                        ReturnItemData item = (ReturnItemData)data.ITEM[i];
                        itemDAL.REQUISITION = DALObj.LOID;
                        itemDAL.PRODUCT = item.PDLOID;
                        itemDAL.MASTER = item.MASTER;
                        itemDAL.UNIT = item.UNIT;
                        itemDAL.USEQTY = item.USEQTY;
                        itemDAL.WASTEQTYMAT = item.WASTEQTYMAT;
                        itemDAL.RETURNQTY = item.RETURNQTY;
                        itemDAL.ACTIVE = Constz.ActiveStatus.Active;

                        //                        itemDAL.OnDB = false;
                        ret = itemDAL.InsertCurrentData(userID, obj.zTrans);
                        if (!ret) throw new ApplicationException(itemDAL.ErrorMessage);
                    }
                    obj.zTrans.Commit();
                    obj.CloseConnection();
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    _error = ex.Message;
                }
            }
            else
                ret = false;
            return ret;
        }
Beispiel #6
0
 public bool ValidateData(ReturnRequestData data)
 {
     bool ret = true;
     if (data.LOTNO.Trim() == "")
     {
         ret = false;
         _error = "¡ÃسÒÃкØàÅ¢·Õè¡ÒüÅÔµ";
     }
     //else if (data.REQDATE.Year == 1)
     //{
     //    ret = false;
     //    _error = "¡ÃسÒÇѹ·ÕèºÑ¹·Ö¡ÃÒ¡ÒÃ";
     //}
     //else if (data.REASON == "")
     //{
     //    ret = false;
     //    _error = "¡ÃسÒÃкØà˵ؼÅ㹡Òâͫ×éÍ";
     //}
     else if (data.ITEM.Count == 0)
     {
         ret = false;
         _error = "¡ÃسÒÃкØÃÒ¡ÒÃÊÔ¹¤éÒ";
     }
     return ret;
 }
Beispiel #7
0
        public ReturnRequestData GetAllData(double loid)
        {
            // Get Old Data From Requisition 

            ReturnRequestData data = new ReturnRequestData();
            if (DALObj.GetDataByLOID(loid, null))
            {
                data.REQDATE = DALObj.REQDATE;
                data.CODE = DALObj.CODE;
                data.CREATEBY = DALObj.CREATEBY;
                data.STATUS = DALObj.STATUS;
                data.REMARK = DALObj.REMARK;
                data.LOTNO = DALObj.LOTNO;
                data.WAREHOUSE = DALObj.WAREHOUSE;
                data.LOTNO = DALObj.LOTNO;
                data.REFLOID = DALObj.REFLOID;
                data.LOID = DALObj.LOID;
                //ReturnRequestData data2 = GetPDDataFromLOT(data.LOTNO);
                //data.PDBARCODE = data2.PDBARCODE;
                //data.PDNAME = data2.PDNAME;
                //data.BATCHSIZE = data2.BATCHSIZE;
                //data.BATCHSIZEUNITNAME = data2.BATCHSIZEUNITNAME;


            }
            return data;
        }
Beispiel #8
0
    private void SetData(ReturnRequestData data)
    {
        // Setdata from Old REQUISITION
        if (data.REQDATE.Year == 1) data.REQDATE = DateTime.Now.Date;

        this.txtLOID.Text = data.LOID.ToString(); //######
        this.txtStatus.Text = (data.STATUS != "" ? data.STATUS: txtStatus.Text);
        this.txtStatusName.Text = (data.STATUS == Constz.Requisition.Status.Approved.Code ? Constz.Requisition.Status.Approved.Name : (data.STATUS == Constz.Requisition.Status.Void.Code ? Constz.Requisition.Status.Void.Name : (data.STATUS == Constz.Requisition.Status.QC.Code ? Constz.Requisition.Status.QC.Name : (data.STATUS == Constz.Requisition.Status.Finish.Code ? Constz.Requisition.Status.Finish.Name : Constz.Requisition.Status.Waiting.Name))));
        this.txtWareHouse.Text = (data.WAREHOUSE != 0 ? data.WAREHOUSE.ToString() : txtWareHouse.Text);
        this.txtRequisitionCode.Text = data.CODE;
        this.txtLotNo.Text = data.LOTNO;
        this.ctlReqDate.DateValue = data.REQDATE;
        this.txtRemark.Text = data.REMARK;
        //this.txtCreateBy.Text = data.CREATEBY;
        this.txtPDCode.Text = data.PDBARCODE;
        this.txtPDName.Text = data.PDNAME;
        if (this.txtLOID.Text != "0")
        {
            this.txtRefLoid.Text = data.REFLOID.ToString();
            SetDataPD(FlowObj.GetRefData(data.REFLOID));
        }


        //this.txtQty.Text = Convert.ToString(data.BATCHSIZE);
        //this.txtQtyUnit.Text = data.BATCHSIZEUNITNAME;
        //this.txtVPLOID.Text = data.VPLOID.ToString();

        SetGrvItem(this.txtStatus.Text);

        if (data.STATUS == Constz.Requisition.Status.Approved.Code)
        {
            this.ctlToolbar.BtnSaveShow = false;
            this.ctlToolbar.BtnSubmitShow = false;
        }
        this.ctlToolbar.ClientClickPrint = ABB.Global.Appz.ReportScript(Constz.Report.ReturnRequestPD, Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text)) + "return false;";
    }
Beispiel #9
0
 private ReturnRequestData GetData()
 {
     ReturnRequestData data = new ReturnRequestData();
     data.LOID = Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text);
     data.REQUISITIONTYPE = Constz.Requisition.RequisitionType.REQ14;
     data.ACTIVE = Constz.ActiveStatus.Active;
     data.WAREHOUSE = Convert.ToDouble(this.txtWareHouse.Text == "" ? "0" : this.txtWareHouse.Text);
     data.LOTNO = this.txtLotNo.Text.Trim();
     data.PDNAME = this.txtPDName.Text  ;
     data.PDBARCODE = this.txtPDCode.Text.Trim();
     data.REMARK = this.txtRemark.Text.Trim();data.STATUS = this.txtStatus.Text.Trim();
     data.REFTABLE = "PDPRODUCT";
     data.REFLOID = Convert.ToDouble(this.txtRefLoid.Text == "" ? "0" : this.txtRefLoid.Text);
     data.ITEM = ItemObj.GetItemList();
     data.REQDATE = ctlReqDate.DateValue;
     data.STATUS = txtStatus.Text.Trim();
     data.CODE = txtRequisitionCode.Text.Trim();
     
     return data;
 }
Beispiel #10
0
 private void SetDataPD(ReturnRequestData data)
 {
     this.txtPDCode.Text = data.PDBARCODE;
     this.txtPDName.Text = data.PDNAME;
 }