コード例 #1
0
ファイル: StockOutFGFlow.cs プロジェクト: SoftSuite/ABB
        public bool NewStockOut(string userID, double requisition)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                RequisitionDAL rDAL = new RequisitionDAL();
                rDAL.GetDataByLOID(requisition, obj.zTrans);
                if (rDAL.OnDB)
                {
                    DocTypeDAL dDAL = new DocTypeDAL();
                    dDAL.GetDataByRequisitionType(rDAL.REQUISITIONTYPE, obj.zTrans);

                    DALObj.OnDB = false;
                    DALObj.ACTIVE = Constz.ActiveStatus.Active;
                    DALObj.DOCTYPE = dDAL.LOID;
                    DALObj.RECEIVER = rDAL.WAREHOUSE;
                    DALObj.REFLOID = rDAL.LOID;
                    DALObj.REFTABLE = "REQUISITION";
                    DALObj.REQDATE = DateTime.Today;
                    DALObj.SENDER = rDAL.WAREHOUSE;
                    DALObj.STATUS = Constz.Requisition.Status.Waiting.Code;

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

                    _LOID = DALObj.LOID;
                }
                else
                {
                    throw new ApplicationException("äÁ辺¢éÍÁÙŤӢÍ");
                }

                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }
            return ret;
        }
コード例 #2
0
ファイル: ToDoListFlow.cs プロジェクト: SoftSuite/ABB
        public bool NewStockOut(string userID, double requisition, double warehouse)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                RequisitionDAL reqDAL = new RequisitionDAL();
                reqDAL.GetDataByLOID(requisition, obj.zTrans);

                ReqMaterialDAL reqItemDAL = new ReqMaterialDAL();
                DataTable dt = CompareLot(reqItemDAL.GetDataByRequisition(requisition, obj.zTrans),warehouse);

                DocTypeDAL docDAL = new DocTypeDAL();
                docDAL.GetDataByRequisitionType(reqDAL.REQUISITIONTYPE, obj.zTrans);

                StockOutDAL _DAL = new StockOutDAL();
                _DAL.OnDB = false;
                _DAL.ACTIVE = Constz.ActiveStatus.Active;
                _DAL.DOCTYPE = docDAL.LOID;
                _DAL.RECEIVER = (reqDAL.CUSTOMER != 0 ? reqDAL.CUSTOMER : reqDAL.WAREHOUSE);
                _DAL.REFLOID = reqDAL.LOID;
                _DAL.REFTABLE = reqDAL.TableName;
                _DAL.REQDATE = reqDAL.REQDATE;
                _DAL.SENDER = warehouse;
                _DAL.STATUS = Constz.Requisition.Status.Waiting.Code;
                _DAL.PRODUCTREF = "PDPRODUCT";
                _DAL.PRODUCTLOID = reqDAL.REFLOID;

                ret = _DAL.InsertCurrentData(userID, obj.zTrans);
                if (!ret)
                {
                    throw new ApplicationException(_DAL.ErrorMessage);
                }
                StockOutItemDAL _DALItem = new StockOutItemDAL();
                foreach (DataRow dRow in dt.Rows)
                {
                    _DALItem.OnDB = false;
                    _DALItem.LOTNO = dRow["LOTNO"].ToString();
                    _DALItem.PRODUCT = Convert.ToDouble(dRow["PRODUCT"]);
                    _DALItem.QTY = Convert.ToDouble(dRow["MASTER"]);
                    _DALItem.REFLOID = Convert.ToDouble(dRow["LOID"]);
                    _DALItem.REFTABLE = "REQUISITIONITEM";
                    _DALItem.STATUS = Constz.Requisition.Status.Waiting.Code;
                    _DALItem.STOCKOUT = _DAL.LOID;
                    _DALItem.UNIT = Convert.ToDouble(dRow["UNIT"]);
                    _DALItem.ACTIVE = Constz.ActiveStatus.Active;
                    _DALItem.REMAIN = Convert.ToDouble(dRow["REMAINQTY"]);

                    ret = _DALItem.InsertCurrentData(userID, obj.zTrans);
                    if (!ret)
                    {
                        throw new ApplicationException(_DALItem.ErrorMessage);
                    }
                }

                _LOID = _DAL.LOID;

                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }
            return ret;
        }
コード例 #3
0
ファイル: StockoutFlow.cs プロジェクト: SoftSuite/ABB
        public StockOutFGReqData GetRequisitionData(double requisition)
        {
            StockOutFGReqData data = new StockOutFGReqData();
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                ReqDAL.GetDataByLOID(requisition, obj.zTrans);
                data.CADDRESS = ReqDAL.CADDRESS;
                data.CFAX = ReqDAL.CFAX;
                data.CLASTNAME = ReqDAL.CLASTNAME;
                data.CNAME = ReqDAL.CNAME;
                data.CTEL = ReqDAL.CTEL;
                data.CTITLE = ReqDAL.CTITLE;
                data.CUSTOMER = ReqDAL.CUSTOMER;
                CustomerDAL cDAL = new CustomerDAL();
                cDAL.GetDataByLOID(data.CUSTOMER, obj.zTrans);
                data.CUSTOMERCODE = cDAL.CODE;
                data.CUSTOMERNAME = (cDAL.NAME + " " + cDAL.LASTNAME).Trim();
                data.REQUISITION = ReqDAL.LOID;
                data.REQUISITIONCODE = ReqDAL.CODE;
                data.REQUISITIONTYPE = ReqDAL.REQUISITIONTYPE;
                data.RESERVEDATE = ReqDAL.RESERVEDATE;
                data.REQDATE = ReqDAL.REQDATE;
                DocTypeDAL dDAL = new DocTypeDAL();
                dDAL.GetDataByRequisitionType(data.REQUISITIONTYPE, obj.zTrans);
                data.DOCTYPE = dDAL.LOID;

                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                _error = ex.Message;
            }
            return data;
        }
コード例 #4
0
ファイル: ToDoListFlow.cs プロジェクト: SoftSuite/ABB
        public bool NewStockOut(string userID, double requisition, double warehouse)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                RequisitionDAL reqDAL = new RequisitionDAL();
                reqDAL.GetDataByLOID(requisition, obj.zTrans);

                RequisitionItemDAL reqItemDAL = new RequisitionItemDAL();
                DataTable dt = reqItemDAL.GetDataByRequisition(requisition, obj.zTrans);

                DocTypeDAL docDAL = new DocTypeDAL();
                docDAL.GetDataByRequisitionType(reqDAL.REQUISITIONTYPE, obj.zTrans);

                StockOutDAL _DAL = new StockOutDAL();
                _DAL.OnDB = false;
                _DAL.ACTIVE = Constz.ActiveStatus.Active;
                _DAL.DOCTYPE = docDAL.LOID;
                _DAL.RECEIVER = (reqDAL.CUSTOMER != 0 ? reqDAL.CUSTOMER : reqDAL.WAREHOUSE);
                _DAL.REFLOID = reqDAL.LOID;
                _DAL.REFTABLE = reqDAL.TableName;
                _DAL.REQDATE = reqDAL.REQDATE;
                _DAL.SENDER = warehouse;
                _DAL.STATUS = Constz.Requisition.Status.Waiting.Code;
                _DAL.CTITLE = reqDAL.CTITLE;
                _DAL.CNAME = reqDAL.CNAME;
                _DAL.CLASTNAME = reqDAL.CLASTNAME;
                _DAL.CADDRESS = reqDAL.CADDRESS;
                _DAL.CFAX = reqDAL.CFAX;
                _DAL.CTEL = reqDAL.CTEL;

                ret = _DAL.InsertCurrentData(userID, obj.zTrans);
                if (!ret)
                {
                    throw new ApplicationException(_DAL.ErrorMessage);
                }
                StockOutItemDAL _DALItem = new StockOutItemDAL();
                foreach (DataRow dRow in dt.Rows)
                {
                    StockFGDAL fgDAL = new StockFGDAL();
                    double qty = Convert.ToDouble(dRow["QTY"]);
                    DataTable dtStock = fgDAL.GetProductStock(warehouse, Convert.ToDouble(dRow["PRODUCT"]), obj.zTrans);
                    foreach (DataRow sRow in dtStock.Rows)
                    {
                        _DALItem.OnDB = false;
                        _DALItem.LOTNO = sRow["LOTNO"].ToString();
                        _DALItem.PRODUCT = Convert.ToDouble(dRow["PRODUCT"]);
                        if (qty >= Convert.ToDouble(sRow["QTY"]))
                            _DALItem.QTY = Convert.ToDouble(sRow["QTY"]);
                        else
                            _DALItem.QTY = qty;
                        _DALItem.REFLOID = Convert.ToDouble(dRow["LOID"]);
                        _DALItem.REFTABLE = "REQUISITIONITEM";
                        _DALItem.STATUS = Constz.Requisition.Status.Waiting.Code;
                        _DALItem.STOCKOUT = _DAL.LOID;
                        _DALItem.UNIT = Convert.ToDouble(dRow["UNIT"]);
                        _DALItem.ACTIVE = Constz.ActiveStatus.Active;
                        _DALItem.PRICE = Convert.ToDouble(dRow["PRICE"]);
                        double remain = _DALItem.GetRemainQTYStockFG(_DALItem.LOTNO, _DALItem.PRODUCT, obj.zTrans);
                        _DALItem.REMAIN = remain;
                        qty -= Convert.ToDouble(sRow["QTY"]);

                        ret = _DALItem.InsertCurrentData(userID, obj.zTrans);
                        if (!ret)
                        {
                            throw new ApplicationException(_DALItem.ErrorMessage);
                        }

                        if (qty <= 0) break;
                    }

                }

                _LOID = _DAL.LOID;

                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }
            return ret;
        }
コード例 #5
0
ファイル: StockOutFGFlow.cs プロジェクト: SoftSuite/ABB
        public StockOutFGReqData GetRequisitionData(double requisition)
        {
            StockOutFGReqData data = new StockOutFGReqData();
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                ReqDAL.GetDataByLOID(requisition, obj.zTrans);
                data.CADDRESS = ReqDAL.CADDRESS;
                data.CFAX = ReqDAL.CFAX;
                data.CLASTNAME = ReqDAL.CLASTNAME;
                data.CNAME = ReqDAL.CNAME;
                data.CTEL = ReqDAL.CTEL;
                data.CTITLE = ReqDAL.CTITLE;
                data.CUSTOMER = ReqDAL.CUSTOMER;
                data.WAREHOUSE = ReqDAL.WAREHOUSE;
                data.REFWAREHOUSE = ReqDAL.REFWAREHOUSE == 0 ? ReqDAL.WAREHOUSE : ReqDAL.REFWAREHOUSE;
                WarehouseDAL wDAL = new WarehouseDAL();
                wDAL.GetDataByLOID(data.WAREHOUSE, obj.zTrans);
                data.WAREHOUSECODE = wDAL.CODE;
                data.WAREHOUSENAME = wDAL.NAME;
                CustomerDAL cDAL = new CustomerDAL();
                cDAL.GetDataByLOID(data.CUSTOMER, obj.zTrans);
                data.CUSTOMERCODE = cDAL.CODE;
                data.CUSTOMERNAME = (cDAL.NAME + " " + cDAL.LASTNAME).Trim();
                data.REQUISITION = ReqDAL.LOID;
                data.REQUISITIONCODE = ReqDAL.CODE;
                data.REQUISITIONTYPE = ReqDAL.REQUISITIONTYPE;
                data.RESERVEDATE = ReqDAL.RESERVEDATE;
                data.REQDATE = ReqDAL.REQDATE;
                DocTypeDAL dDAL = new DocTypeDAL();
                dDAL.GetDataByRequisitionType(data.REQUISITIONTYPE, obj.zTrans);
                data.DOCTYPE = dDAL.LOID;
                RequisitionItemDAL reqItemDAL = new RequisitionItemDAL();
                DataTable dt = GetProductLot(data.REQUISITION, data.REFWAREHOUSE);
                int i = 1;
                foreach (DataRow dRow in dt.Rows)
                {
                    dRow["NO"] = i;
                    i += 1;
                }
                data.REQUISITIONITEM = dt;

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