Exemplo n.º 1
0
    private void SearchData()
    {
        BomSearchData data = new BomSearchData();
        data.PRODUCTTYPE = Convert.ToDouble(this.cmbProductType.SelectedValue);
        data.PRODUCTGROUP = Convert.ToDouble(this.cmbProductGroup.SelectedValue);
        data.PRODUCTNAME = this.txtProductName.Text.Trim();

        this.gvResult.DataSource = FlowObj.GetBomProductList(data);
        this.gvResult.DataBind();
    }
Exemplo n.º 2
0
 public DataTable GetBomProductList(BomSearchData data)
 {
     DataTable dt = BomSearchItem.GetBomProductList(data);
     int i = 1;
     foreach (DataRow dRow in dt.Rows)
     {
         dRow["RANK"] = i;
         i += 1;
     }
     return dt;
 }
Exemplo n.º 3
0
        public DataTable GetBomProductList(BomSearchData data)
        {
            string where = "P.LOID IN (SELECT MAINPRODUCT FROM BOM) ";
            if (data.PRODUCTTYPE != 0)
                where += (where == "" ? "" : "AND ") + "PRODUCTTYPE = " + data.PRODUCTTYPE.ToString() + " ";

            if (data.PRODUCTGROUP != 0)
                where += (where == "" ? "" : "AND ") + "PRODUCTGROUP = " + data.PRODUCTGROUP.ToString() + " ";

            if (data.PRODUCTNAME.Trim() != "")
                where += (where == "" ? "" : "AND ") + "UPPER(P.NAME) LIKE '%" + data.PRODUCTNAME.Trim() + "%' ";

            string sql = "SELECT 0 RANK, P.BARCODE, P.NAME, UNIT.NAME UNITNAME, PG.NAME PRODUCTGROUP, PT.NAME PRODUCTTYPE, P.LOTSIZE, P.LOID ";
            sql += "FROM PRODUCT P INNER JOIN PRODUCTGROUP PG ON PG.LOID = P.PRODUCTGROUP ";
            sql += "INNER JOIN PRODUCTTYPE PT ON PT.LOID = PG.PRODUCTTYPE AND PT.TYPE = '" + Constz.ProductType.Type.FG.Code + "' ";
            sql += "INNER JOIN UNIT ON UNIT.LOID = P.UNIT ";
            sql += (where == "" ? "" : "WHERE ") + where;
            sql += "ORDER BY P.BARCODE ";
            return OracleDB.ExecListCmd(sql);
        }
Exemplo n.º 4
0
 private BomSearchData GetData()
 {
     BomSearchData data = new BomSearchData();
     data.ACTIVE = (this.chkActive.Checked ? Constz.ActiveStatus.Active : Constz.ActiveStatus.InActive);
     data.BARCODE = this.txtBarcode.Text.Trim();
     data.MAINPRODUCT = Convert.ToDouble(this.cmbProduct.SelectedItem.Value);
     data.OLDMAINPRODUCT = Convert.ToDouble(this.txtProduct.Text == "" ? "0" : this.txtProduct.Text);
     data.PROCESS = this.txtProcess.Text.Trim();
     data.RADIATION = (this.Radiation.Checked ? Constz.Radiation.Yes : Constz.Radiation.No);
     data.ITEM = ItemObj.GetItemList();
     return data;
 }
Exemplo n.º 5
0
 public BomSearchData GetBomData(double productBarcode)
 {
     BomSearchData data = new BomSearchData();
     DataTable dt = BomSearchItem.GetBomProductData(productBarcode);
     if (dt.Rows.Count == 1)
     {
         DataRow dRow = dt.Rows[0];
         data.ACTIVE = dRow["ACTIVE"].ToString();
         data.BARCODE = dRow["BARCODE"].ToString();
         data.MAINPRODUCT = Convert.ToDouble(dRow["MAINPRODUCT"]);
         data.PROCESS = dRow["PROCESS"].ToString();
         data.PRODUCTGROUP = Convert.ToDouble(dRow["PRODUCTGROUP"]);
         data.PRODUCTTYPE = Convert.ToDouble(dRow["PRODUCTTYPE"]);
         data.RADIATION = dRow["RADIATION"].ToString();
     }
     return data;
 }
Exemplo n.º 6
0
        public bool UpdateData(string userID, BomSearchData data)
        {
            bool ret = true;
            if (VerifyData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateTransaction();
                try
                {
                    BomItem.DeleteDataByMainProduct(data.OLDMAINPRODUCT, obj.zTrans);
                    BomItem.DeleteDataByMainProduct(data.MAINPRODUCT, obj.zTrans);
                    BarcodeDAL.GetDataByLOID(data.MAINPRODUCT, obj.zTrans);
                    ProcessItem.GetDataByProduct(BarcodeDAL.PRODUCTMASTER, obj.zTrans);
                    ProcessItem.ACTIVE = Data.Constz.ActiveStatus.Active;
                    ProcessItem.PROCESS = data.PROCESS;
                    ProcessItem.RADIATION = data.RADIATION;
                    ProcessItem.PRODUCT = BarcodeDAL.PRODUCTMASTER;
                    if (ProcessItem.OnDB)
                        ret = ProcessItem.UpdateCurrentData(userID, obj.zTrans);
                    else
                        ret = ProcessItem.InsertCurrentData(userID, obj.zTrans);
                    if (!ret) throw new ApplicationException(ProcessItem.ErrorMessage);

                    for (int i = 0; i < data.ITEM.Count; ++i)
                    {
                        BomData dataItem = (BomData)data.ITEM[i];
                        BomItem.OnDB = false;
                        BomItem.ACTIVE = data.ACTIVE;
                        BomItem.MAINPRODUCT = data.MAINPRODUCT;
                        BomItem.MASTER = dataItem.MASTER;
                        BomItem.MATERIAL = dataItem.MATERIAL;
                        BomItem.PROCESS = ProcessItem.LOID;
                        BomItem.RADIATION = data.RADIATION;
                        BomItem.UNIT = dataItem.UNIT;
                        ret = BomItem.InsertCurrentData(userID, obj.zTrans);
                        if (!ret) throw new ApplicationException(BomItem.ErrorMessage);
                    }

                    obj.zTrans.Commit();
                    obj.CloseConnection();
                }
                catch (Exception ex)
                {
                    ret = false;
                    _error = ex.Message;
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                }
            }
            else
            {
                ret = false;
            }
            return ret;
        }
Exemplo n.º 7
0
 private bool VerifyData(BomSearchData data)
 {
     bool ret = true;
     if (data.MAINPRODUCT == 0)
     {
         ret = false;
         _error = "¡ÃسÒàÅ×Í¡ÊÔ¹¤éÒ";
     }
     else if (data.PROCESS.Trim() == "")
     {
         ret = false;
         _error = "¡ÃسÒÃкØÇÔ¸ÕàµÃÕÂÁ";
     }
     else if (data.ITEM.Count == 0)
     {
         ret = false;
         _error = "¡ÃسÒÃкØÇѵشԺ·Õèµéͧ¡ÒÃãªé";
     }
     else if (data.OLDMAINPRODUCT != data.MAINPRODUCT)
     {
         if (BomItem.GetDataList("WHERE MAINPRODUCT = " + data.MAINPRODUCT.ToString(), null).Rows.Count > 0)
         {
             ret = false;
             _error = "ª×èÍÊÔ¹¤éÒ·ÕèàÅ×Í¡«éÓ";
         }
     }
     return ret;
 }