Пример #1
0
        //新建工单
        public int createOrder(String remark, int workType, Boolean isPublic, List <String> customerInfo, int cityId, int customerId, List <String> productInfo, int createUserId, int technicianId, int stationId)
        {
            int       orderStatus = 2;
            ProductDB productDb   = new ProductDB();

            String    year        = DateTime.Now.ToString("yy");
            StationDB stationDb   = new StationDB();
            String    stationCode = stationDb.stationQueryByStationId(stationId).Tables[0].Rows[0]["StationCode"].ToString();
            int       orderIdNum  = Convert.ToInt16(orderDb.orderIdCount(stationCode, year)) + 1;
            String    orderId     = stationCode + year + orderIdNum.ToString("00000");

            //判读客户是否为新建的(需审核)
            if (customerId == 0)
            {
                orderStatus = 1;

                CustomerDB customerDb = new CustomerDB();
                if (customerDb.customerCreate(customerInfo, false, cityId) == 1)
                {
                    customerId = Convert.ToInt16(customerDb.customerIdQueryByEndCustomerName(customerInfo[1]));
                }
                else
                {
                    return(-1);
                }
            }

            if (productDb.productCreate(productInfo, orderId) != 1)
            {
                return(-2);
            }

            if (orderDb.orderCreate(orderId, remark, workType, createUserId, technicianId, customerId, stationId, orderStatus, isPublic) != 1)
            {
                return(-3);
            }

            if (orderDb.orderLogCreate(orderId, createUserId, 0, orderStatus) != 1)
            {
                return(-4);
            }

            return(1);
        }
Пример #2
0
 public StationManager(StationDB stationDB)
 {
     this.StationDB = stationDB;
 }
Пример #3
0
        public DataSet orderQueryByOrderId(String orderId, Boolean isOnlyOrderInfo)
        {
            DataSet   orderInfoDataSet = new DataSet();
            DataTable dt = orderDb.orderQueryByOrderId(orderId).Tables[0];

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            dt.TableName = "OrderInfoTable";
            orderInfoDataSet.Tables.Add(dt.Copy());

            if (isOnlyOrderInfo == true)
            {
                return(orderInfoDataSet);
            }

            int customerId   = Convert.ToInt16(dt.Rows[0]["CustomerId"]);
            int stationId    = Convert.ToInt16(dt.Rows[0]["StationId"]);
            int createUserId = Convert.ToInt16(dt.Rows[0]["CreateUserId"]);
            int technicianId = Convert.ToInt16(dt.Rows[0]["TechnicianId"]);
            int adminId      = Convert.ToInt16(dt.Rows[0]["AdminId"]);

            CustomerDB customerDb = new CustomerDB();

            dt           = customerDb.customerQueryByCustomerId(customerId).Tables[0];
            dt.TableName = "CustomerTable";
            orderInfoDataSet.Tables.Add(dt.Copy());

            ProductDB productDb = new ProductDB();

            dt           = productDb.productQuery(orderId).Tables[0];
            dt.TableName = "ProductTable";
            orderInfoDataSet.Tables.Add(dt.Copy());

            SparePartDB sparePartDb = new SparePartDB();

            dt           = sparePartDb.sparePartQuery(orderId).Tables[0];
            dt.TableName = "SparePartTable";
            orderInfoDataSet.Tables.Add(dt.Copy());

            StationDB stationDb = new StationDB();

            dt           = stationDb.stationQueryByStationId(stationId).Tables[0];
            dt.TableName = "StationTable";
            orderInfoDataSet.Tables.Add(dt.Copy());

            dt           = orderDb.orderLogQuery(orderId).Tables[0];
            dt.TableName = "OrderLogTable";
            orderInfoDataSet.Tables.Add(dt.Copy());

            UserDB userDb = new UserDB();

            dt           = userDb.userQueryByUserId(technicianId).Tables[0];
            dt.TableName = "TechnicianTable";
            orderInfoDataSet.Tables.Add(dt.Copy());

            dt           = userDb.userQueryByUserId(createUserId).Tables[0];
            dt.TableName = "CreateUserTable";
            orderInfoDataSet.Tables.Add(dt.Copy());

            dt           = userDb.userQueryByUserId(adminId).Tables[0];
            dt.TableName = "AdminTable";
            orderInfoDataSet.Tables.Add(dt.Copy());

            RepairLogDB repairLogDb = new RepairLogDB();

            dt           = repairLogDb.repairLogQuery(orderId).Tables[0];
            dt.TableName = "RepairLogTable";
            orderInfoDataSet.Tables.Add(dt.Copy());

            return(orderInfoDataSet);
        }